2014-03-28 02:50:40 +01:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Text ;
using DS4Library ;
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
using System.Threading.Tasks ;
using System.Windows.Forms ;
2014-03-28 02:50:40 +01:00
namespace DS4Control
{
2014-04-27 21:32:09 +02:00
public class Mapping
2014-03-28 02:50:40 +01:00
{
2014-04-27 21:32:09 +02:00
/ *
* Represent the synthetic keyboard and mouse events . Maintain counts for each so we don ' t duplicate events .
* /
2014-05-28 04:49:58 +02:00
public class SyntheticState
2014-03-28 02:50:40 +01:00
{
2014-04-27 21:32:09 +02:00
public struct MouseClick
2014-03-28 02:50:40 +01:00
{
2014-05-28 04:49:58 +02:00
public int leftCount , middleCount , rightCount , fourthCount , fifthCount , wUpCount , wDownCount , toggleCount ;
public bool toggle ;
2014-04-27 21:32:09 +02:00
}
public MouseClick previousClicks , currentClicks ;
public struct KeyPress
{
2014-05-28 04:49:58 +02:00
public int vkCount , scanCodeCount , repeatCount , toggleCount ; // repeat takes priority over non-, and scancode takes priority over non-
public bool toggle ;
2014-04-27 21:32:09 +02:00
}
public class KeyPresses
{
public KeyPress previous , current ;
}
public Dictionary < UInt16 , KeyPresses > keyPresses = new Dictionary < UInt16 , KeyPresses > ( ) ;
public void SavePrevious ( bool performClear )
{
previousClicks = currentClicks ;
if ( performClear )
2014-05-28 04:49:58 +02:00
currentClicks . leftCount = currentClicks . middleCount = currentClicks . rightCount = currentClicks . fourthCount = currentClicks . fifthCount = currentClicks . wUpCount = currentClicks . wDownCount = currentClicks . toggleCount = 0 ;
2014-04-27 21:32:09 +02:00
foreach ( KeyPresses kp in keyPresses . Values )
{
kp . previous = kp . current ;
if ( performClear )
2014-05-28 04:49:58 +02:00
{
kp . current . repeatCount = kp . current . scanCodeCount = kp . current . vkCount = kp . current . toggleCount = 0 ;
//kp.current.toggle = false;
}
2014-04-27 21:32:09 +02:00
}
}
}
2014-05-28 04:49:58 +02:00
public static SyntheticState globalState = new SyntheticState ( ) ;
public static SyntheticState [ ] deviceState = { new SyntheticState ( ) , new SyntheticState ( ) , new SyntheticState ( ) , new SyntheticState ( ) } ;
2014-04-27 21:32:09 +02:00
// TODO When we disconnect, process a null/dead state to release any keys or buttons.
2014-05-23 04:42:07 +02:00
public static DateTime oldnow = DateTime . UtcNow ;
2014-05-06 20:49:18 +02:00
private static bool pressagain = false ;
private static int wheel = 0 , keyshelddown = 0 ;
2014-04-27 21:32:09 +02:00
public static void Commit ( int device )
{
SyntheticState state = deviceState [ device ] ;
lock ( globalState )
{
globalState . currentClicks . leftCount + = state . currentClicks . leftCount - state . previousClicks . leftCount ;
globalState . currentClicks . middleCount + = state . currentClicks . middleCount - state . previousClicks . middleCount ;
globalState . currentClicks . rightCount + = state . currentClicks . rightCount - state . previousClicks . rightCount ;
globalState . currentClicks . fourthCount + = state . currentClicks . fourthCount - state . previousClicks . fourthCount ;
globalState . currentClicks . fifthCount + = state . currentClicks . fifthCount - state . previousClicks . fifthCount ;
globalState . currentClicks . wUpCount + = state . currentClicks . wUpCount - state . previousClicks . wUpCount ;
2014-05-28 04:49:58 +02:00
globalState . currentClicks . wDownCount + = state . currentClicks . wDownCount - state . previousClicks . wDownCount ;
globalState . currentClicks . toggleCount + = state . currentClicks . toggleCount - state . previousClicks . toggleCount ;
globalState . currentClicks . toggle = state . currentClicks . toggle ;
if ( globalState . currentClicks . toggleCount ! = 0 & & globalState . previousClicks . toggleCount = = 0 & & globalState . currentClicks . toggle )
2014-05-06 20:49:18 +02:00
{
2014-05-28 04:49:58 +02:00
if ( globalState . currentClicks . leftCount ! = 0 & & globalState . previousClicks . leftCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTDOWN ) ;
if ( globalState . currentClicks . rightCount ! = 0 & & globalState . previousClicks . rightCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTDOWN ) ;
if ( globalState . currentClicks . middleCount ! = 0 & & globalState . previousClicks . middleCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEDOWN ) ;
if ( globalState . currentClicks . fourthCount ! = 0 & & globalState . previousClicks . fourthCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 1 ) ;
if ( globalState . currentClicks . fifthCount ! = 0 & & globalState . previousClicks . fifthCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 2 ) ;
2014-05-06 20:49:18 +02:00
}
2014-05-28 04:49:58 +02:00
else if ( globalState . currentClicks . toggleCount ! = 0 & & globalState . previousClicks . toggleCount = = 0 & & ! globalState . currentClicks . toggle )
2014-05-06 20:49:18 +02:00
{
2014-05-28 04:49:58 +02:00
if ( globalState . currentClicks . leftCount ! = 0 & & globalState . previousClicks . leftCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTUP ) ;
if ( globalState . currentClicks . rightCount ! = 0 & & globalState . previousClicks . rightCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTUP ) ;
if ( globalState . currentClicks . middleCount ! = 0 & & globalState . previousClicks . middleCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEUP ) ;
if ( globalState . currentClicks . fourthCount ! = 0 & & globalState . previousClicks . fourthCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 1 ) ;
if ( globalState . currentClicks . fifthCount ! = 0 & & globalState . previousClicks . fifthCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 2 ) ;
2014-05-06 20:49:18 +02:00
}
2014-05-28 04:49:58 +02:00
if ( globalState . currentClicks . toggleCount = = 0 & & globalState . previousClicks . toggleCount = = 0 )
{
if ( globalState . currentClicks . leftCount ! = 0 & & globalState . previousClicks . leftCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTDOWN ) ;
else if ( globalState . currentClicks . leftCount = = 0 & & globalState . previousClicks . leftCount ! = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTUP ) ;
if ( globalState . currentClicks . middleCount ! = 0 & & globalState . previousClicks . middleCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEDOWN ) ;
else if ( globalState . currentClicks . middleCount = = 0 & & globalState . previousClicks . middleCount ! = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEUP ) ;
if ( globalState . currentClicks . rightCount ! = 0 & & globalState . previousClicks . rightCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTDOWN ) ;
else if ( globalState . currentClicks . rightCount = = 0 & & globalState . previousClicks . rightCount ! = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTUP ) ;
if ( globalState . currentClicks . fourthCount ! = 0 & & globalState . previousClicks . fourthCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 1 ) ;
else if ( globalState . currentClicks . fourthCount = = 0 & & globalState . previousClicks . fourthCount ! = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 1 ) ;
if ( globalState . currentClicks . fifthCount ! = 0 & & globalState . previousClicks . fifthCount = = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 2 ) ;
else if ( globalState . currentClicks . fifthCount = = 0 & & globalState . previousClicks . fifthCount ! = 0 )
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 2 ) ;
if ( globalState . currentClicks . wUpCount ! = 0 & & globalState . previousClicks . wUpCount = = 0 )
{
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_WHEEL , 100 ) ;
oldnow = DateTime . UtcNow ;
wheel = 100 ;
}
else if ( globalState . currentClicks . wUpCount = = 0 & & globalState . previousClicks . wUpCount ! = 0 )
wheel = 0 ;
if ( globalState . currentClicks . wDownCount ! = 0 & & globalState . previousClicks . wDownCount = = 0 )
{
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_WHEEL , - 100 ) ;
oldnow = DateTime . UtcNow ;
wheel = - 100 ;
}
if ( globalState . currentClicks . wDownCount = = 0 & & globalState . previousClicks . wDownCount ! = 0 )
wheel = 0 ;
}
2014-05-06 20:49:18 +02:00
if ( wheel ! = 0 ) //Continue mouse wheel movement
{
2014-05-23 04:42:07 +02:00
DateTime now = DateTime . UtcNow ;
2014-05-06 20:49:18 +02:00
if ( now > = oldnow + TimeSpan . FromMilliseconds ( 100 ) & & ! pressagain )
{
oldnow = now ;
InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_WHEEL , wheel ) ;
}
}
2014-04-27 21:32:09 +02:00
// Merge and synthesize all key presses/releases that are present in this device's mapping.
// TODO what about the rest? e.g. repeat keys really ought to be on some set schedule
foreach ( KeyValuePair < UInt16 , SyntheticState . KeyPresses > kvp in state . keyPresses )
2014-03-28 02:50:40 +01:00
{
2014-04-27 21:32:09 +02:00
SyntheticState . KeyPresses gkp ;
if ( globalState . keyPresses . TryGetValue ( kvp . Key , out gkp ) )
{
gkp . current . vkCount + = kvp . Value . current . vkCount - kvp . Value . previous . vkCount ;
gkp . current . scanCodeCount + = kvp . Value . current . scanCodeCount - kvp . Value . previous . scanCodeCount ;
gkp . current . repeatCount + = kvp . Value . current . repeatCount - kvp . Value . previous . repeatCount ;
2014-05-28 04:49:58 +02:00
gkp . current . toggle = kvp . Value . current . toggle ;
gkp . current . toggleCount + = kvp . Value . current . toggleCount - kvp . Value . previous . toggleCount ;
2014-04-27 21:32:09 +02:00
}
else
{
gkp = new SyntheticState . KeyPresses ( ) ;
gkp . current = kvp . Value . current ;
globalState . keyPresses [ kvp . Key ] = gkp ;
}
2014-05-28 04:49:58 +02:00
if ( gkp . current . toggleCount ! = 0 & & gkp . previous . toggleCount = = 0 & & gkp . current . toggle )
{
if ( gkp . current . scanCodeCount ! = 0 )
InputMethods . performSCKeyPress ( kvp . Key ) ;
else
InputMethods . performKeyPress ( kvp . Key ) ;
}
else if ( gkp . current . toggleCount ! = 0 & & gkp . previous . toggleCount = = 0 & & ! gkp . current . toggle )
{
if ( gkp . previous . scanCodeCount ! = 0 ) // use the last type of VK/SC
InputMethods . performSCKeyRelease ( kvp . Key ) ;
else
InputMethods . performKeyRelease ( kvp . Key ) ;
}
else if ( gkp . current . vkCount + gkp . current . scanCodeCount ! = 0 & & gkp . previous . vkCount + gkp . previous . scanCodeCount = = 0 )
2014-04-27 21:32:09 +02:00
{
if ( gkp . current . scanCodeCount ! = 0 )
2014-05-06 20:49:18 +02:00
{
2014-05-23 04:42:07 +02:00
oldnow = DateTime . UtcNow ;
2014-04-27 21:32:09 +02:00
InputMethods . performSCKeyPress ( kvp . Key ) ;
2014-05-06 20:49:18 +02:00
pressagain = false ;
keyshelddown = kvp . Key ;
}
2014-04-27 21:32:09 +02:00
else
2014-05-06 20:49:18 +02:00
{
2014-05-23 04:42:07 +02:00
oldnow = DateTime . UtcNow ;
2014-04-27 21:32:09 +02:00
InputMethods . performKeyPress ( kvp . Key ) ;
2014-05-06 20:49:18 +02:00
pressagain = false ;
keyshelddown = kvp . Key ;
}
2014-04-27 21:32:09 +02:00
}
2014-05-28 04:49:58 +02:00
else if ( gkp . current . toggleCount ! = 0 | | gkp . previous . toggleCount ! = 0 | | gkp . current . repeatCount ! = 0 | | // repeat or SC/VK transition
2014-05-07 06:35:08 +02:00
( ( gkp . previous . scanCodeCount = = 0 ) ! = ( gkp . current . scanCodeCount = = 0 ) ) ) //repeat keystroke after 500ms
2014-03-28 02:50:40 +01:00
{
2014-05-06 20:49:18 +02:00
if ( keyshelddown = = kvp . Key )
{
2014-05-23 04:42:07 +02:00
DateTime now = DateTime . UtcNow ;
2014-05-06 20:49:18 +02:00
if ( now > = oldnow + TimeSpan . FromMilliseconds ( 500 ) & & ! pressagain )
{
oldnow = now ;
pressagain = true ;
}
if ( pressagain & & gkp . current . scanCodeCount ! = 0 )
{
2014-05-23 04:42:07 +02:00
now = DateTime . UtcNow ;
2014-05-06 21:04:42 +02:00
if ( now > = oldnow + TimeSpan . FromMilliseconds ( 25 ) & & pressagain )
{
oldnow = now ;
InputMethods . performSCKeyPress ( kvp . Key ) ;
2014-05-28 04:49:58 +02:00
}
2014-05-06 20:49:18 +02:00
}
else if ( pressagain )
{
2014-05-23 04:42:07 +02:00
now = DateTime . UtcNow ;
2014-05-06 21:04:42 +02:00
if ( now > = oldnow + TimeSpan . FromMilliseconds ( 25 ) & & pressagain )
{
oldnow = now ;
InputMethods . performKeyPress ( kvp . Key ) ;
}
2014-05-06 20:49:18 +02:00
}
}
2014-04-27 21:32:09 +02:00
}
2014-05-28 04:49:58 +02:00
else if ( ( gkp . current . toggleCount = = 0 & & gkp . previous . toggleCount = = 0 ) & & gkp . current . vkCount + gkp . current . scanCodeCount = = 0 & & gkp . previous . vkCount + gkp . previous . scanCodeCount ! = 0 )
2014-04-27 21:32:09 +02:00
{
if ( gkp . previous . scanCodeCount ! = 0 ) // use the last type of VK/SC
2014-05-06 20:49:18 +02:00
{
2014-04-27 21:32:09 +02:00
InputMethods . performSCKeyRelease ( kvp . Key ) ;
2014-06-21 20:00:28 +02:00
//InputMethods.performKeyRelease(kvp.Key);
2014-05-06 20:49:18 +02:00
pressagain = false ;
}
2014-04-27 21:32:09 +02:00
else
2014-05-06 20:49:18 +02:00
{
2014-04-27 21:32:09 +02:00
InputMethods . performKeyRelease ( kvp . Key ) ;
2014-05-06 20:49:18 +02:00
pressagain = false ;
}
2014-03-28 02:50:40 +01:00
}
}
2014-04-27 21:32:09 +02:00
globalState . SavePrevious ( false ) ;
}
state . SavePrevious ( true ) ;
}
public enum Click { None , Left , Middle , Right , Fourth , Fifth , WUP , WDOWN } ;
public static void MapClick ( int device , Click mouseClick )
{
switch ( mouseClick )
{
case Click . Left :
deviceState [ device ] . currentClicks . leftCount + + ;
break ;
case Click . Middle :
deviceState [ device ] . currentClicks . middleCount + + ;
break ;
case Click . Right :
deviceState [ device ] . currentClicks . rightCount + + ;
break ;
case Click . Fourth :
deviceState [ device ] . currentClicks . fourthCount + + ;
break ;
case Click . Fifth :
deviceState [ device ] . currentClicks . fifthCount + + ;
break ;
case Click . WUP :
deviceState [ device ] . currentClicks . wUpCount + + ;
break ;
case Click . WDOWN :
deviceState [ device ] . currentClicks . wDownCount + + ;
break ;
}
}
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
public static int DS4ControltoInt ( DS4Controls ctrl )
{
switch ( ctrl )
{
case DS4Controls . Share : return 1 ;
case DS4Controls . Options : return 2 ;
case DS4Controls . L1 : return 3 ;
case DS4Controls . R1 : return 4 ;
case DS4Controls . L3 : return 5 ;
case DS4Controls . R3 : return 6 ;
case DS4Controls . DpadUp : return 7 ;
case DS4Controls . DpadDown : return 8 ;
case DS4Controls . DpadLeft : return 9 ;
case DS4Controls . DpadRight : return 10 ;
case DS4Controls . PS : return 11 ;
case DS4Controls . Cross : return 12 ;
case DS4Controls . Square : return 13 ;
case DS4Controls . Triangle : return 14 ;
case DS4Controls . Circle : return 15 ;
case DS4Controls . LXNeg : return 16 ;
case DS4Controls . LYNeg : return 17 ;
case DS4Controls . RXNeg : return 18 ;
case DS4Controls . RYNeg : return 19 ;
case DS4Controls . LXPos : return 20 ;
case DS4Controls . LYPos : return 21 ;
case DS4Controls . RXPos : return 22 ;
case DS4Controls . RYPos : return 23 ;
case DS4Controls . L2 : return 24 ;
case DS4Controls . R2 : return 25 ;
case DS4Controls . TouchMulti : return 26 ;
case DS4Controls . TouchLeft : return 27 ;
case DS4Controls . TouchRight : return 28 ;
case DS4Controls . TouchUpper : return 29 ;
2014-06-26 20:02:01 +02:00
case DS4Controls . GyroXNeg : return 30 ;
case DS4Controls . GyroXPos : return 31 ;
case DS4Controls . GyroZNeg : return 32 ;
case DS4Controls . GyroZPos : return 33 ;
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
}
return 0 ;
}
2014-06-26 20:02:01 +02:00
public static bool [ ] pressedonce = new bool [ 261 ] , macrodone = new bool [ 34 ] ;
2014-05-28 04:49:58 +02:00
public static int test = 0 ;
2014-11-14 20:44:50 +01:00
static bool [ ] macroControl = new bool [ 25 ] ;
2014-04-27 21:32:09 +02:00
/** Map DS4 Buttons/Axes to other DS4 Buttons/Axes (largely the same as Xinput ones) and to keyboard and mouse buttons. */
2014-10-31 00:56:51 +01:00
public static async void MapCustom ( int device , DS4State cState , DS4State MappedState , DS4StateExposed eState , Mouse tp )
2014-04-27 21:32:09 +02:00
{
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
bool shift ;
2014-04-27 21:32:09 +02:00
SyntheticState deviceState = Mapping . deviceState [ device ] ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
switch ( Global . getShiftModifier ( device ) )
2014-05-28 04:49:58 +02:00
{
2014-10-31 00:56:51 +01:00
case 1 : shift = getBoolMapping ( DS4Controls . Cross , cState , eState , tp ) ; break ;
case 2 : shift = getBoolMapping ( DS4Controls . Circle , cState , eState , tp ) ; break ;
case 3 : shift = getBoolMapping ( DS4Controls . Square , cState , eState , tp ) ; break ;
case 4 : shift = getBoolMapping ( DS4Controls . Triangle , cState , eState , tp ) ; break ;
case 5 : shift = getBoolMapping ( DS4Controls . Options , cState , eState , tp ) ; break ;
case 6 : shift = getBoolMapping ( DS4Controls . Share , cState , eState , tp ) ; break ;
case 7 : shift = getBoolMapping ( DS4Controls . DpadUp , cState , eState , tp ) ; break ;
case 8 : shift = getBoolMapping ( DS4Controls . DpadDown , cState , eState , tp ) ; break ;
case 9 : shift = getBoolMapping ( DS4Controls . DpadLeft , cState , eState , tp ) ; break ;
case 10 : shift = getBoolMapping ( DS4Controls . DpadRight , cState , eState , tp ) ; break ;
case 11 : shift = getBoolMapping ( DS4Controls . PS , cState , eState , tp ) ; break ;
case 12 : shift = getBoolMapping ( DS4Controls . L1 , cState , eState , tp ) ; break ;
case 13 : shift = getBoolMapping ( DS4Controls . R1 , cState , eState , tp ) ; break ;
case 14 : shift = getBoolMapping ( DS4Controls . L2 , cState , eState , tp ) ; break ;
case 15 : shift = getBoolMapping ( DS4Controls . R2 , cState , eState , tp ) ; break ;
case 16 : shift = getBoolMapping ( DS4Controls . L3 , cState , eState , tp ) ; break ;
case 17 : shift = getBoolMapping ( DS4Controls . R3 , cState , eState , tp ) ; break ;
case 18 : shift = getBoolMapping ( DS4Controls . TouchLeft , cState , eState , tp ) ; break ;
case 19 : shift = getBoolMapping ( DS4Controls . TouchUpper , cState , eState , tp ) ; break ;
case 20 : shift = getBoolMapping ( DS4Controls . TouchMulti , cState , eState , tp ) ; break ;
case 21 : shift = getBoolMapping ( DS4Controls . TouchRight , cState , eState , tp ) ; break ;
case 22 : shift = getBoolMapping ( DS4Controls . GyroZNeg , cState , eState , tp ) ; break ;
case 23 : shift = getBoolMapping ( DS4Controls . GyroZPos , cState , eState , tp ) ; break ;
case 24 : shift = getBoolMapping ( DS4Controls . GyroXPos , cState , eState , tp ) ; break ;
case 25 : shift = getBoolMapping ( DS4Controls . GyroXNeg , cState , eState , tp ) ; break ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
case 26 : shift = cState . Touch1 ; break ;
default : shift = false ; break ;
}
2014-11-01 22:49:22 +01:00
cState . CopyTo ( MappedState ) ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
if ( shift )
2014-10-31 00:56:51 +01:00
MapShiftCustom ( device , cState , MappedState , eState , tp ) ;
2014-11-14 20:44:50 +01:00
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
foreach ( KeyValuePair < DS4Controls , string > customKey in Global . getCustomMacros ( device ) )
{
if ( shift = = false | |
( Global . getShiftCustomMacro ( device , customKey . Key ) = = "0" & &
Global . getShiftCustomKey ( device , customKey . Key ) = = 0 & &
2014-07-08 20:21:09 +02:00
Global . getShiftCustomButton ( device , customKey . Key ) = = X360Controls . None ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
DS4KeyType keyType = Global . getCustomKeyType ( device , customKey . Key ) ;
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customKey . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
resetToDefaultValue ( customKey . Key , MappedState ) ;
bool LXChanged = ( Math . Abs ( 127 - MappedState . LX ) < 5 ) ;
bool LYChanged = ( Math . Abs ( 127 - MappedState . LY ) < 5 ) ;
bool RXChanged = ( Math . Abs ( 127 - MappedState . RX ) < 5 ) ;
bool RYChanged = ( Math . Abs ( 127 - MappedState . RY ) < 5 ) ;
string [ ] skeys ;
int [ ] keys ;
if ( ! string . IsNullOrEmpty ( customKey . Value ) )
{
skeys = customKey . Value . Split ( '/' ) ;
keys = new int [ skeys . Length ] ;
}
else
{
skeys = new string [ 0 ] ;
keys = new int [ 0 ] ;
}
for ( int i = 0 ; i < keys . Length ; i + + )
keys [ i ] = ushort . Parse ( skeys [ i ] ) ;
2014-11-14 20:44:50 +01:00
bool [ ] keydown = new bool [ 286 ] ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
if ( ! macrodone [ DS4ControltoInt ( customKey . Key ) ] )
{
macrodone [ DS4ControltoInt ( customKey . Key ) ] = true ;
for ( int i = 0 ; i < keys . Length ; i + + )
{
if ( keys [ i ] > = 300 ) //ints over 300 used to delay
await Task . Delay ( keys [ i ] - 300 ) ;
2014-11-14 20:44:50 +01:00
else if ( ! keydown [ keys [ i ] ] )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
if ( keys [ i ] = = 256 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTDOWN ) ; //anything above 255 is not a keyvalue
else if ( keys [ i ] = = 257 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTDOWN ) ;
else if ( keys [ i ] = = 258 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEDOWN ) ;
else if ( keys [ i ] = = 259 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 1 ) ;
else if ( keys [ i ] = = 260 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 2 ) ;
2014-11-14 20:44:50 +01:00
else if ( keys [ i ] = = 261 ) macroControl [ 0 ] = true ;
else if ( keys [ i ] = = 262 ) macroControl [ 1 ] = true ;
else if ( keys [ i ] = = 263 ) macroControl [ 2 ] = true ;
else if ( keys [ i ] = = 264 ) macroControl [ 3 ] = true ;
else if ( keys [ i ] = = 265 ) macroControl [ 4 ] = true ;
else if ( keys [ i ] = = 266 ) macroControl [ 5 ] = true ;
else if ( keys [ i ] = = 267 ) macroControl [ 6 ] = true ;
else if ( keys [ i ] = = 268 ) macroControl [ 7 ] = true ;
else if ( keys [ i ] = = 269 ) macroControl [ 8 ] = true ;
else if ( keys [ i ] = = 270 ) macroControl [ 9 ] = true ;
else if ( keys [ i ] = = 271 ) macroControl [ 10 ] = true ;
else if ( keys [ i ] = = 272 ) macroControl [ 11 ] = true ;
else if ( keys [ i ] = = 273 ) macroControl [ 12 ] = true ;
else if ( keys [ i ] = = 274 ) macroControl [ 13 ] = true ;
else if ( keys [ i ] = = 275 ) macroControl [ 14 ] = true ;
else if ( keys [ i ] = = 276 ) macroControl [ 15 ] = true ;
else if ( keys [ i ] = = 277 ) macroControl [ 16 ] = true ;
else if ( keys [ i ] = = 278 ) macroControl [ 17 ] = true ;
else if ( keys [ i ] = = 279 ) macroControl [ 18 ] = true ;
else if ( keys [ i ] = = 280 ) macroControl [ 19 ] = true ;
else if ( keys [ i ] = = 281 ) macroControl [ 20 ] = true ;
else if ( keys [ i ] = = 282 ) macroControl [ 21 ] = true ;
else if ( keys [ i ] = = 283 ) macroControl [ 22 ] = true ;
else if ( keys [ i ] = = 284 ) macroControl [ 23 ] = true ;
else if ( keys [ i ] = = 285 ) macroControl [ 24 ] = true ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
else if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
InputMethods . performSCKeyPress ( ( ushort ) keys [ i ] ) ;
else
InputMethods . performKeyPress ( ( ushort ) keys [ i ] ) ;
keydown [ keys [ i ] ] = true ;
}
2014-11-14 20:44:50 +01:00
else
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
if ( keys [ i ] = = 256 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTUP ) ; //anything above 255 is not a keyvalue
else if ( keys [ i ] = = 257 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTUP ) ;
else if ( keys [ i ] = = 258 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEUP ) ;
else if ( keys [ i ] = = 259 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 1 ) ;
else if ( keys [ i ] = = 260 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 2 ) ;
2014-11-14 20:44:50 +01:00
else if ( keys [ i ] = = 261 ) macroControl [ 0 ] = false ;
else if ( keys [ i ] = = 262 ) macroControl [ 1 ] = false ;
else if ( keys [ i ] = = 263 ) macroControl [ 2 ] = false ;
else if ( keys [ i ] = = 264 ) macroControl [ 3 ] = false ;
else if ( keys [ i ] = = 265 ) macroControl [ 4 ] = false ;
else if ( keys [ i ] = = 266 ) macroControl [ 5 ] = false ;
else if ( keys [ i ] = = 267 ) macroControl [ 6 ] = false ;
else if ( keys [ i ] = = 268 ) macroControl [ 7 ] = false ;
else if ( keys [ i ] = = 269 ) macroControl [ 8 ] = false ;
else if ( keys [ i ] = = 270 ) macroControl [ 9 ] = false ;
else if ( keys [ i ] = = 271 ) macroControl [ 10 ] = false ;
else if ( keys [ i ] = = 272 ) macroControl [ 11 ] = false ;
else if ( keys [ i ] = = 273 ) macroControl [ 12 ] = false ;
else if ( keys [ i ] = = 274 ) macroControl [ 13 ] = false ;
else if ( keys [ i ] = = 275 ) macroControl [ 14 ] = false ;
else if ( keys [ i ] = = 276 ) macroControl [ 15 ] = false ;
else if ( keys [ i ] = = 277 ) macroControl [ 16 ] = false ;
else if ( keys [ i ] = = 278 ) macroControl [ 17 ] = false ;
else if ( keys [ i ] = = 279 ) macroControl [ 18 ] = false ;
else if ( keys [ i ] = = 280 ) macroControl [ 19 ] = false ;
else if ( keys [ i ] = = 281 ) macroControl [ 20 ] = false ;
else if ( keys [ i ] = = 282 ) macroControl [ 21 ] = false ;
else if ( keys [ i ] = = 283 ) macroControl [ 22 ] = false ;
else if ( keys [ i ] = = 284 ) macroControl [ 23 ] = false ;
else if ( keys [ i ] = = 285 ) macroControl [ 24 ] = false ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
else if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
InputMethods . performSCKeyRelease ( ( ushort ) keys [ i ] ) ;
else
InputMethods . performKeyRelease ( ( ushort ) keys [ i ] ) ;
keydown [ keys [ i ] ] = false ;
}
}
for ( ushort i = 0 ; i < keydown . Length ; i + + )
{
if ( keydown [ i ] )
2014-11-14 20:44:50 +01:00
if ( i = = 256 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTUP ) ; //anything above 255 is not a keyvalue
else if ( i = = 257 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTUP ) ;
else if ( i = = 258 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEUP ) ;
else if ( i = = 259 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 1 ) ;
else if ( i = = 260 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 2 ) ;
else if ( i = = 261 ) macroControl [ 0 ] = false ;
else if ( i = = 262 ) macroControl [ 1 ] = false ;
else if ( i = = 263 ) macroControl [ 2 ] = false ;
else if ( i = = 264 ) macroControl [ 3 ] = false ;
else if ( i = = 265 ) macroControl [ 4 ] = false ;
else if ( i = = 266 ) macroControl [ 5 ] = false ;
else if ( i = = 267 ) macroControl [ 6 ] = false ;
else if ( i = = 268 ) macroControl [ 7 ] = false ;
else if ( i = = 269 ) macroControl [ 8 ] = false ;
else if ( i = = 270 ) macroControl [ 9 ] = false ;
else if ( i = = 271 ) macroControl [ 10 ] = false ;
else if ( i = = 272 ) macroControl [ 11 ] = false ;
else if ( i = = 273 ) macroControl [ 12 ] = false ;
else if ( i = = 274 ) macroControl [ 13 ] = false ;
else if ( i = = 275 ) macroControl [ 14 ] = false ;
else if ( i = = 276 ) macroControl [ 15 ] = false ;
else if ( i = = 277 ) macroControl [ 16 ] = false ;
else if ( keys [ i ] = = 278 ) macroControl [ 17 ] = false ;
else if ( keys [ i ] = = 279 ) macroControl [ 18 ] = false ;
else if ( keys [ i ] = = 280 ) macroControl [ 19 ] = false ;
else if ( keys [ i ] = = 281 ) macroControl [ 20 ] = false ;
else if ( keys [ i ] = = 282 ) macroControl [ 21 ] = false ;
else if ( keys [ i ] = = 283 ) macroControl [ 22 ] = false ;
else if ( keys [ i ] = = 284 ) macroControl [ 23 ] = false ;
else if ( keys [ i ] = = 285 ) macroControl [ 24 ] = false ;
else if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
InputMethods . performSCKeyRelease ( i ) ;
else
InputMethods . performKeyRelease ( i ) ;
}
if ( keyType . HasFlag ( DS4KeyType . HoldMacro ) )
{
await Task . Delay ( 50 ) ;
macrodone [ DS4ControltoInt ( customKey . Key ) ] = false ;
}
}
}
2014-10-31 00:56:51 +01:00
else if ( ! getBoolMapping ( customKey . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
macrodone [ DS4ControltoInt ( customKey . Key ) ] = false ;
}
}
foreach ( KeyValuePair < DS4Controls , ushort > customKey in Global . getCustomKeys ( device ) )
{
if ( shift = = false | |
( Global . getShiftCustomMacro ( device , customKey . Key ) = = "0" & &
Global . getShiftCustomKey ( device , customKey . Key ) = = 0 & &
2014-07-08 20:21:09 +02:00
Global . getShiftCustomButton ( device , customKey . Key ) = = X360Controls . None ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
DS4KeyType keyType = Global . getCustomKeyType ( device , customKey . Key ) ;
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customKey . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
resetToDefaultValue ( customKey . Key , MappedState ) ;
SyntheticState . KeyPresses kp ;
if ( ! deviceState . keyPresses . TryGetValue ( customKey . Value , out kp ) )
deviceState . keyPresses [ customKey . Value ] = kp = new SyntheticState . KeyPresses ( ) ;
if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
kp . current . scanCodeCount + + ;
else
kp . current . vkCount + + ;
if ( keyType . HasFlag ( DS4KeyType . Toggle ) )
{
if ( ! pressedonce [ customKey . Value ] )
{
kp . current . toggle = ! kp . current . toggle ;
pressedonce [ customKey . Value ] = true ;
}
kp . current . toggleCount + + ;
}
kp . current . repeatCount + + ;
}
else
pressedonce [ customKey . Value ] = false ;
}
}
MappedState . LX = 127 ;
MappedState . LY = 127 ;
MappedState . RX = 127 ;
MappedState . RY = 127 ;
int MouseDeltaX = 0 ;
int MouseDeltaY = 0 ;
2014-11-14 20:44:50 +01:00
//Dictionary<DS4Controls, X360Controls> customButtons = Global.getCustomButtons(device);
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
//foreach (KeyValuePair<DS4Controls, X360Controls> customButton in customButtons)
2014-10-21 04:31:13 +02:00
List < DS4Controls > Cross = new List < DS4Controls > ( ) ;
List < DS4Controls > Circle = new List < DS4Controls > ( ) ;
List < DS4Controls > Square = new List < DS4Controls > ( ) ;
List < DS4Controls > Triangle = new List < DS4Controls > ( ) ;
List < DS4Controls > Options = new List < DS4Controls > ( ) ;
List < DS4Controls > Share = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadUp = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadDown = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadLeft = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadRight = new List < DS4Controls > ( ) ;
List < DS4Controls > PS = new List < DS4Controls > ( ) ;
List < DS4Controls > L1 = new List < DS4Controls > ( ) ;
List < DS4Controls > R1 = new List < DS4Controls > ( ) ;
List < DS4Controls > L2 = new List < DS4Controls > ( ) ;
List < DS4Controls > R2 = new List < DS4Controls > ( ) ;
List < DS4Controls > L3 = new List < DS4Controls > ( ) ;
List < DS4Controls > R3 = new List < DS4Controls > ( ) ;
List < DS4Controls > LXN = new List < DS4Controls > ( ) ;
List < DS4Controls > LXP = new List < DS4Controls > ( ) ;
List < DS4Controls > LYN = new List < DS4Controls > ( ) ;
List < DS4Controls > LYP = new List < DS4Controls > ( ) ;
List < DS4Controls > RXN = new List < DS4Controls > ( ) ;
List < DS4Controls > RXP = new List < DS4Controls > ( ) ;
List < DS4Controls > RYN = new List < DS4Controls > ( ) ;
List < DS4Controls > RYP = new List < DS4Controls > ( ) ;
2014-11-14 20:44:50 +01:00
foreach ( KeyValuePair < DS4Controls , X360Controls > customButton in Global . getCustomButtons ( device ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
if ( shift = = false | |
( Global . getShiftCustomMacro ( device , customButton . Key ) = = "0" & &
Global . getShiftCustomKey ( device , customButton . Key ) = = 0 & &
2014-07-08 20:21:09 +02:00
Global . getShiftCustomButton ( device , customButton . Key ) = = X360Controls . None ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
DS4KeyType keyType = Global . getCustomKeyType ( device , customButton . Key ) ;
int keyvalue = 0 ;
switch ( customButton . Value )
{
case X360Controls . LeftMouse : keyvalue = 256 ; break ;
case X360Controls . RightMouse : keyvalue = 257 ; break ;
case X360Controls . MiddleMouse : keyvalue = 258 ; break ;
case X360Controls . FourthMouse : keyvalue = 259 ; break ;
case X360Controls . FifthMouse : keyvalue = 260 ; break ;
}
if ( keyType . HasFlag ( DS4KeyType . Toggle ) )
{
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
resetToDefaultValue ( customButton . Key , MappedState ) ;
if ( ! pressedonce [ keyvalue ] )
{
deviceState . currentClicks . toggle = ! deviceState . currentClicks . toggle ;
test + + ;
pressedonce [ keyvalue ] = true ;
}
deviceState . currentClicks . toggleCount + + ;
}
2014-10-21 04:31:13 +02:00
else // if (test = 1) && pressedonce[keyvalue])
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
pressedonce [ keyvalue ] = false ;
}
}
2014-10-21 04:31:13 +02:00
resetToDefaultValue ( customButton . Key , MappedState ) ; // erase default mappings for things that are remapped
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
switch ( customButton . Value )
{
2014-10-21 04:31:13 +02:00
case X360Controls . A : Cross . Add ( customButton . Key ) ; break ;
case X360Controls . B : Circle . Add ( customButton . Key ) ; break ;
case X360Controls . X : Square . Add ( customButton . Key ) ; break ;
case X360Controls . Y : Triangle . Add ( customButton . Key ) ; break ;
case X360Controls . LB : L1 . Add ( customButton . Key ) ; break ;
case X360Controls . LS : L3 . Add ( customButton . Key ) ; break ;
case X360Controls . RB : R1 . Add ( customButton . Key ) ; break ;
case X360Controls . RS : R3 . Add ( customButton . Key ) ; break ;
case X360Controls . DpadUp : DpadUp . Add ( customButton . Key ) ; break ;
case X360Controls . DpadDown : DpadDown . Add ( customButton . Key ) ; break ;
case X360Controls . DpadLeft : DpadLeft . Add ( customButton . Key ) ; break ;
case X360Controls . DpadRight : DpadRight . Add ( customButton . Key ) ; break ;
case X360Controls . Start : Options . Add ( customButton . Key ) ; break ;
case X360Controls . Guide : PS . Add ( customButton . Key ) ; break ;
case X360Controls . Back : Share . Add ( customButton . Key ) ; break ;
case X360Controls . LXNeg : LXN . Add ( customButton . Key ) ; break ;
case X360Controls . LYNeg : LYN . Add ( customButton . Key ) ; break ;
case X360Controls . RXNeg : RXN . Add ( customButton . Key ) ; break ;
case X360Controls . RYNeg : RYN . Add ( customButton . Key ) ; break ;
case X360Controls . LXPos : LXP . Add ( customButton . Key ) ; break ;
case X360Controls . LYPos : LYP . Add ( customButton . Key ) ; break ;
case X360Controls . RXPos : RXP . Add ( customButton . Key ) ; break ;
case X360Controls . RYPos : RYP . Add ( customButton . Key ) ; break ;
case X360Controls . LT : L2 . Add ( customButton . Key ) ; break ;
case X360Controls . RT : R2 . Add ( customButton . Key ) ; break ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
case X360Controls . LeftMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
deviceState . currentClicks . leftCount + + ;
break ;
case X360Controls . RightMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
deviceState . currentClicks . rightCount + + ;
break ;
case X360Controls . MiddleMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
deviceState . currentClicks . middleCount + + ;
break ;
case X360Controls . FourthMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
deviceState . currentClicks . fourthCount + + ;
break ;
case X360Controls . FifthMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
deviceState . currentClicks . fifthCount + + ;
break ;
case X360Controls . WUP :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
deviceState . currentClicks . wUpCount + + ;
break ;
case X360Controls . WDOWN :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
deviceState . currentClicks . wDownCount + + ;
break ;
case X360Controls . MouseUp :
if ( MouseDeltaY = = 0 )
{
MouseDeltaY = getMouseMapping ( device , customButton . Key , cState , eState , 0 ) ;
MouseDeltaY = - Math . Abs ( ( MouseDeltaY = = - 2147483648 ? 0 : MouseDeltaY ) ) ;
}
break ;
case X360Controls . MouseDown :
if ( MouseDeltaY = = 0 )
{
MouseDeltaY = getMouseMapping ( device , customButton . Key , cState , eState , 1 ) ;
MouseDeltaY = Math . Abs ( ( MouseDeltaY = = - 2147483648 ? 0 : MouseDeltaY ) ) ;
}
break ;
case X360Controls . MouseLeft :
if ( MouseDeltaX = = 0 )
{
MouseDeltaX = getMouseMapping ( device , customButton . Key , cState , eState , 2 ) ;
MouseDeltaX = - Math . Abs ( ( MouseDeltaX = = - 2147483648 ? 0 : MouseDeltaX ) ) ;
}
break ;
case X360Controls . MouseRight :
if ( MouseDeltaX = = 0 )
{
MouseDeltaX = getMouseMapping ( device , customButton . Key , cState , eState , 3 ) ;
MouseDeltaX = Math . Abs ( ( MouseDeltaX = = - 2147483648 ? 0 : MouseDeltaX ) ) ;
}
break ;
}
}
}
2014-11-14 20:44:50 +01:00
if ( macroControl [ 0 ] ) MappedState . Cross = true ;
if ( macroControl [ 01 ] ) MappedState . Circle = true ;
if ( macroControl [ 02 ] ) MappedState . Square = true ;
if ( macroControl [ 03 ] ) MappedState . Triangle = true ;
if ( macroControl [ 04 ] ) MappedState . Options = true ;
if ( macroControl [ 05 ] ) MappedState . Share = true ;
if ( macroControl [ 06 ] ) MappedState . DpadUp = true ;
if ( macroControl [ 07 ] ) MappedState . DpadDown = true ;
if ( macroControl [ 08 ] ) MappedState . DpadLeft = true ;
if ( macroControl [ 09 ] ) MappedState . DpadRight = true ;
if ( macroControl [ 10 ] ) MappedState . PS = true ;
if ( macroControl [ 11 ] ) MappedState . L1 = true ;
if ( macroControl [ 12 ] ) MappedState . R1 = true ;
if ( macroControl [ 13 ] ) MappedState . L2 = 255 ;
if ( macroControl [ 14 ] ) MappedState . R2 = 255 ;
if ( macroControl [ 15 ] ) MappedState . L3 = true ;
if ( macroControl [ 16 ] ) MappedState . R3 = true ;
if ( macroControl [ 17 ] ) MappedState . LX = 255 ;
if ( macroControl [ 18 ] ) MappedState . LX = 0 ;
if ( macroControl [ 19 ] ) MappedState . LY = 255 ;
if ( macroControl [ 20 ] ) MappedState . LY = 0 ;
if ( macroControl [ 21 ] ) MappedState . RX = 255 ;
if ( macroControl [ 22 ] ) MappedState . RX = 0 ;
if ( macroControl [ 23 ] ) MappedState . RY = 255 ;
if ( macroControl [ 24 ] ) MappedState . RY = 0 ;
2014-10-21 04:31:13 +02:00
foreach ( DS4Controls dc in Cross )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Cross = true ;
foreach ( DS4Controls dc in Circle )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Circle = true ;
foreach ( DS4Controls dc in Square )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Square = true ;
foreach ( DS4Controls dc in Triangle )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Triangle = true ;
foreach ( DS4Controls dc in L1 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . L1 = true ;
foreach ( DS4Controls dc in L2 )
2014-11-21 20:56:31 +01:00
if ( getByteMapping ( device , dc , cState , eState , tp ) > 5 )
2014-10-31 00:56:51 +01:00
MappedState . L2 = getByteMapping ( device , dc , cState , eState , tp ) ;
2014-10-21 04:31:13 +02:00
foreach ( DS4Controls dc in L3 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . L3 = true ;
foreach ( DS4Controls dc in R1 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . R1 = true ;
foreach ( DS4Controls dc in R2 )
2014-11-21 20:56:31 +01:00
if ( getByteMapping ( device , dc , cState , eState , tp ) > 5 )
2014-10-31 00:56:51 +01:00
MappedState . R2 = getByteMapping ( device , dc , cState , eState , tp ) ;
2014-10-21 04:31:13 +02:00
foreach ( DS4Controls dc in R3 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . R3 = true ;
foreach ( DS4Controls dc in DpadUp )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadUp = true ;
foreach ( DS4Controls dc in DpadRight )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadRight = true ;
foreach ( DS4Controls dc in DpadLeft )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadLeft = true ;
foreach ( DS4Controls dc in DpadDown )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadDown = true ;
foreach ( DS4Controls dc in Options )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Options = true ;
foreach ( DS4Controls dc in Share )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Share = true ;
foreach ( DS4Controls dc in PS )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . PS = true ;
2014-10-31 00:56:51 +01:00
if ( Global . getCustomButton ( device , DS4Controls . LXNeg ) = = X360Controls . None )
LXN . Add ( DS4Controls . LXNeg ) ;
if ( Global . getCustomButton ( device , DS4Controls . LXPos ) = = X360Controls . None )
LXP . Add ( DS4Controls . LXPos ) ;
if ( Global . getCustomButton ( device , DS4Controls . LYNeg ) = = X360Controls . None )
LYN . Add ( DS4Controls . LYNeg ) ;
if ( Global . getCustomButton ( device , DS4Controls . LYPos ) = = X360Controls . None )
LYP . Add ( DS4Controls . LYPos ) ;
if ( Global . getCustomButton ( device , DS4Controls . RXNeg ) = = X360Controls . None )
RXN . Add ( DS4Controls . RXNeg ) ;
if ( Global . getCustomButton ( device , DS4Controls . RXPos ) = = X360Controls . None )
RXP . Add ( DS4Controls . RXPos ) ;
if ( Global . getCustomButton ( device , DS4Controls . RYNeg ) = = X360Controls . None )
RYN . Add ( DS4Controls . RYNeg ) ;
if ( Global . getCustomButton ( device , DS4Controls . RYPos ) = = X360Controls . None )
RYP . Add ( DS4Controls . RYPos ) ;
if ( LXN . Count > 0 | | LXP . Count > 0 )
{
foreach ( DS4Controls dc in LXP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . LX = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
foreach ( DS4Controls dc in LXN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . LX = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
}
else
MappedState . LX = cState . LX ;
if ( LYN . Count > 0 | | LYP . Count > 0 )
{
foreach ( DS4Controls dc in LYN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . LY = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
foreach ( DS4Controls dc in LYP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . LY = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
}
else
MappedState . LY = cState . LY ;
if ( RXN . Count > 0 | | RXP . Count > 0 )
{
foreach ( DS4Controls dc in RXN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . RX = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
foreach ( DS4Controls dc in RXP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . RX = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
}
else
MappedState . RX = cState . RX ;
if ( RYN . Count > 0 | | RYP . Count > 0 )
{
foreach ( DS4Controls dc in RYN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . RY = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
foreach ( DS4Controls dc in RYP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . RY = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
}
else
MappedState . RY = cState . RY ;
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
InputMethods . MoveCursorBy ( MouseDeltaX , MouseDeltaY ) ;
}
2014-10-31 00:56:51 +01:00
public static async void MapShiftCustom ( int device , DS4State cState , DS4State MappedState , DS4StateExposed eState , Mouse tp )
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
{
2014-11-01 22:49:22 +01:00
//cState.CopyTo(MappedState);
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
SyntheticState deviceState = Mapping . deviceState [ device ] ;
foreach ( KeyValuePair < DS4Controls , string > customKey in Global . getShiftCustomMacros ( device ) ) //with delays
{
DS4KeyType keyType = Global . getShiftCustomKeyType ( device , customKey . Key ) ;
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customKey . Key , cState , eState , tp ) )
2014-05-28 04:49:58 +02:00
{
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
resetToDefaultValue ( customKey . Key , MappedState ) ;
2014-06-17 01:43:01 +02:00
bool LXChanged = ( Math . Abs ( 127 - MappedState . LX ) < 5 ) ;
bool LYChanged = ( Math . Abs ( 127 - MappedState . LY ) < 5 ) ;
bool RXChanged = ( Math . Abs ( 127 - MappedState . RX ) < 5 ) ;
bool RYChanged = ( Math . Abs ( 127 - MappedState . RY ) < 5 ) ;
2014-06-14 21:14:27 +02:00
string [ ] skeys ;
int [ ] keys ;
if ( ! string . IsNullOrEmpty ( customKey . Value ) )
{
skeys = customKey . Value . Split ( '/' ) ;
keys = new int [ skeys . Length ] ;
}
else
{
skeys = new string [ 0 ] ;
keys = new int [ 0 ] ;
}
2014-05-28 04:49:58 +02:00
for ( int i = 0 ; i < keys . Length ; i + + )
keys [ i ] = ushort . Parse ( skeys [ i ] ) ;
2014-11-14 20:44:50 +01:00
bool [ ] keydown = new bool [ 278 ] ;
2014-06-14 21:14:27 +02:00
if ( ! macrodone [ DS4ControltoInt ( customKey . Key ) ] )
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
{
macrodone [ DS4ControltoInt ( customKey . Key ) ] = true ;
for ( int i = 0 ; i < keys . Length ; i + + )
{
2014-06-14 21:14:27 +02:00
if ( keys [ i ] > = 300 ) //ints over 300 used to delay
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
await Task . Delay ( keys [ i ] - 300 ) ;
2014-11-14 20:44:50 +01:00
else if ( ! keydown [ keys [ i ] ] )
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
{
2014-06-14 21:14:27 +02:00
if ( keys [ i ] = = 256 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTDOWN ) ; //anything above 255 is not a keyvalue
else if ( keys [ i ] = = 257 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTDOWN ) ;
else if ( keys [ i ] = = 258 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEDOWN ) ;
else if ( keys [ i ] = = 259 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 1 ) ;
else if ( keys [ i ] = = 260 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONDOWN , 2 ) ;
2014-11-14 20:44:50 +01:00
else if ( keys [ i ] = = 261 ) macroControl [ 0 ] = true ;
else if ( keys [ i ] = = 262 ) macroControl [ 1 ] = true ;
else if ( keys [ i ] = = 263 ) macroControl [ 2 ] = true ;
else if ( keys [ i ] = = 264 ) macroControl [ 3 ] = true ;
else if ( keys [ i ] = = 265 ) macroControl [ 4 ] = true ;
else if ( keys [ i ] = = 266 ) macroControl [ 5 ] = true ;
else if ( keys [ i ] = = 267 ) macroControl [ 6 ] = true ;
else if ( keys [ i ] = = 268 ) macroControl [ 7 ] = true ;
else if ( keys [ i ] = = 269 ) macroControl [ 8 ] = true ;
else if ( keys [ i ] = = 270 ) macroControl [ 9 ] = true ;
else if ( keys [ i ] = = 271 ) macroControl [ 10 ] = true ;
else if ( keys [ i ] = = 272 ) macroControl [ 11 ] = true ;
else if ( keys [ i ] = = 273 ) macroControl [ 12 ] = true ;
else if ( keys [ i ] = = 274 ) macroControl [ 13 ] = true ;
else if ( keys [ i ] = = 275 ) macroControl [ 14 ] = true ;
else if ( keys [ i ] = = 276 ) macroControl [ 15 ] = true ;
else if ( keys [ i ] = = 277 ) macroControl [ 16 ] = true ;
else if ( keys [ i ] = = 278 ) macroControl [ 17 ] = true ;
else if ( keys [ i ] = = 279 ) macroControl [ 18 ] = true ;
else if ( keys [ i ] = = 280 ) macroControl [ 19 ] = true ;
else if ( keys [ i ] = = 281 ) macroControl [ 20 ] = true ;
else if ( keys [ i ] = = 282 ) macroControl [ 21 ] = true ;
else if ( keys [ i ] = = 283 ) macroControl [ 22 ] = true ;
else if ( keys [ i ] = = 284 ) macroControl [ 23 ] = true ;
else if ( keys [ i ] = = 285 ) macroControl [ 24 ] = true ;
2014-06-14 21:14:27 +02:00
else if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
InputMethods . performSCKeyPress ( ( ushort ) keys [ i ] ) ;
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
else
2014-06-14 21:14:27 +02:00
InputMethods . performKeyPress ( ( ushort ) keys [ i ] ) ;
keydown [ keys [ i ] ] = true ;
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
}
2014-11-14 20:44:50 +01:00
else
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
{
2014-06-14 21:14:27 +02:00
if ( keys [ i ] = = 256 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTUP ) ; //anything above 255 is not a keyvalue
else if ( keys [ i ] = = 257 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTUP ) ;
else if ( keys [ i ] = = 258 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEUP ) ;
else if ( keys [ i ] = = 259 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 1 ) ;
else if ( keys [ i ] = = 260 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 2 ) ;
2014-11-14 20:44:50 +01:00
else if ( keys [ i ] = = 261 ) macroControl [ 0 ] = false ;
else if ( keys [ i ] = = 262 ) macroControl [ 1 ] = false ;
else if ( keys [ i ] = = 263 ) macroControl [ 2 ] = false ;
else if ( keys [ i ] = = 264 ) macroControl [ 3 ] = false ;
else if ( keys [ i ] = = 265 ) macroControl [ 4 ] = false ;
else if ( keys [ i ] = = 266 ) macroControl [ 5 ] = false ;
else if ( keys [ i ] = = 267 ) macroControl [ 6 ] = false ;
else if ( keys [ i ] = = 268 ) macroControl [ 7 ] = false ;
else if ( keys [ i ] = = 269 ) macroControl [ 8 ] = false ;
else if ( keys [ i ] = = 270 ) macroControl [ 9 ] = false ;
else if ( keys [ i ] = = 271 ) macroControl [ 10 ] = false ;
else if ( keys [ i ] = = 272 ) macroControl [ 11 ] = false ;
else if ( keys [ i ] = = 273 ) macroControl [ 12 ] = false ;
else if ( keys [ i ] = = 274 ) macroControl [ 13 ] = false ;
else if ( keys [ i ] = = 275 ) macroControl [ 14 ] = false ;
else if ( keys [ i ] = = 276 ) macroControl [ 15 ] = false ;
else if ( keys [ i ] = = 277 ) macroControl [ 16 ] = false ;
else if ( keys [ i ] = = 278 ) macroControl [ 17 ] = false ;
else if ( keys [ i ] = = 279 ) macroControl [ 18 ] = false ;
else if ( keys [ i ] = = 280 ) macroControl [ 19 ] = false ;
else if ( keys [ i ] = = 281 ) macroControl [ 20 ] = false ;
else if ( keys [ i ] = = 282 ) macroControl [ 21 ] = false ;
else if ( keys [ i ] = = 283 ) macroControl [ 22 ] = false ;
else if ( keys [ i ] = = 284 ) macroControl [ 23 ] = false ;
else if ( keys [ i ] = = 285 ) macroControl [ 24 ] = false ;
2014-06-14 21:14:27 +02:00
else if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
InputMethods . performSCKeyRelease ( ( ushort ) keys [ i ] ) ;
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
else
2014-06-14 21:14:27 +02:00
InputMethods . performKeyRelease ( ( ushort ) keys [ i ] ) ;
keydown [ keys [ i ] ] = false ;
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
}
}
2014-06-14 21:14:27 +02:00
for ( ushort i = 0 ; i < keydown . Length ; i + + )
{
if ( keydown [ i ] )
2014-11-14 20:44:50 +01:00
if ( i = = 256 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_LEFTUP ) ; //anything above 255 is not a keyvalue
else if ( i = = 257 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_RIGHTUP ) ;
else if ( i = = 258 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_MIDDLEUP ) ;
else if ( i = = 259 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 1 ) ;
else if ( i = = 260 ) InputMethods . MouseEvent ( InputMethods . MOUSEEVENTF_XBUTTONUP , 2 ) ;
else if ( i = = 261 ) macroControl [ 0 ] = false ;
else if ( i = = 262 ) macroControl [ 1 ] = false ;
else if ( i = = 263 ) macroControl [ 2 ] = false ;
else if ( i = = 264 ) macroControl [ 3 ] = false ;
else if ( i = = 265 ) macroControl [ 4 ] = false ;
else if ( i = = 266 ) macroControl [ 5 ] = false ;
else if ( i = = 267 ) macroControl [ 6 ] = false ;
else if ( i = = 268 ) macroControl [ 7 ] = false ;
else if ( i = = 269 ) macroControl [ 8 ] = false ;
else if ( i = = 270 ) macroControl [ 9 ] = false ;
else if ( i = = 271 ) macroControl [ 10 ] = false ;
else if ( i = = 272 ) macroControl [ 11 ] = false ;
else if ( i = = 273 ) macroControl [ 12 ] = false ;
else if ( i = = 274 ) macroControl [ 13 ] = false ;
else if ( i = = 275 ) macroControl [ 14 ] = false ;
else if ( i = = 276 ) macroControl [ 15 ] = false ;
else if ( i = = 277 ) macroControl [ 16 ] = false ;
else if ( keys [ i ] = = 278 ) macroControl [ 17 ] = false ;
else if ( keys [ i ] = = 279 ) macroControl [ 18 ] = false ;
else if ( keys [ i ] = = 280 ) macroControl [ 19 ] = false ;
else if ( keys [ i ] = = 281 ) macroControl [ 20 ] = false ;
else if ( keys [ i ] = = 282 ) macroControl [ 21 ] = false ;
else if ( keys [ i ] = = 283 ) macroControl [ 22 ] = false ;
else if ( keys [ i ] = = 284 ) macroControl [ 23 ] = false ;
else if ( keys [ i ] = = 285 ) macroControl [ 24 ] = false ;
else if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
2014-06-14 21:14:27 +02:00
InputMethods . performSCKeyRelease ( i ) ;
else
InputMethods . performKeyRelease ( i ) ;
}
if ( keyType . HasFlag ( DS4KeyType . HoldMacro ) )
{
await Task . Delay ( 50 ) ;
macrodone [ DS4ControltoInt ( customKey . Key ) ] = false ;
}
2014-05-28 04:49:58 +02:00
}
}
2014-10-31 00:56:51 +01:00
else if ( ! getBoolMapping ( customKey . Key , cState , eState , tp ) )
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
macrodone [ DS4ControltoInt ( customKey . Key ) ] = false ;
2014-05-28 04:49:58 +02:00
}
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
foreach ( KeyValuePair < DS4Controls , ushort > customKey in Global . getShiftCustomKeys ( device ) )
2014-04-27 21:32:09 +02:00
{
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
DS4KeyType keyType = Global . getShiftCustomKeyType ( device , customKey . Key ) ;
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customKey . Key , cState , eState , tp ) )
2014-04-27 21:32:09 +02:00
{
resetToDefaultValue ( customKey . Key , MappedState ) ;
SyntheticState . KeyPresses kp ;
if ( ! deviceState . keyPresses . TryGetValue ( customKey . Value , out kp ) )
deviceState . keyPresses [ customKey . Value ] = kp = new SyntheticState . KeyPresses ( ) ;
2014-03-28 02:50:40 +01:00
if ( keyType . HasFlag ( DS4KeyType . ScanCode ) )
2014-04-27 21:32:09 +02:00
kp . current . scanCodeCount + + ;
else
kp . current . vkCount + + ;
2014-05-28 04:49:58 +02:00
if ( keyType . HasFlag ( DS4KeyType . Toggle ) )
{
if ( ! pressedonce [ customKey . Value ] )
{
kp . current . toggle = ! kp . current . toggle ;
pressedonce [ customKey . Value ] = true ;
}
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
kp . current . toggleCount + + ;
2014-05-28 04:49:58 +02:00
}
kp . current . repeatCount + + ;
2014-04-27 21:32:09 +02:00
}
2014-05-28 04:49:58 +02:00
else
pressedonce [ customKey . Value ] = false ;
2014-03-28 02:50:40 +01:00
}
MappedState . LX = 127 ;
MappedState . LY = 127 ;
MappedState . RX = 127 ;
MappedState . RY = 127 ;
2014-04-29 23:56:58 +02:00
int MouseDeltaX = 0 ;
int MouseDeltaY = 0 ;
2014-03-28 02:50:40 +01:00
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
Dictionary < DS4Controls , X360Controls > customButtons = Global . getShiftCustomButtons ( device ) ;
2014-05-28 04:49:58 +02:00
//foreach (KeyValuePair<DS4Controls, X360Controls> customButton in customButtons)
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
// resetToDefaultValue(customButton.Key, MappedState); // erase default mappings for things that are remapped
2014-10-21 04:31:13 +02:00
List < DS4Controls > Cross = new List < DS4Controls > ( ) ;
List < DS4Controls > Circle = new List < DS4Controls > ( ) ;
List < DS4Controls > Square = new List < DS4Controls > ( ) ;
List < DS4Controls > Triangle = new List < DS4Controls > ( ) ;
List < DS4Controls > Options = new List < DS4Controls > ( ) ;
List < DS4Controls > Share = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadUp = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadDown = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadLeft = new List < DS4Controls > ( ) ;
List < DS4Controls > DpadRight = new List < DS4Controls > ( ) ;
List < DS4Controls > PS = new List < DS4Controls > ( ) ;
List < DS4Controls > L1 = new List < DS4Controls > ( ) ;
List < DS4Controls > R1 = new List < DS4Controls > ( ) ;
List < DS4Controls > L2 = new List < DS4Controls > ( ) ;
List < DS4Controls > R2 = new List < DS4Controls > ( ) ;
List < DS4Controls > L3 = new List < DS4Controls > ( ) ;
List < DS4Controls > R3 = new List < DS4Controls > ( ) ;
List < DS4Controls > LXN = new List < DS4Controls > ( ) ;
List < DS4Controls > LXP = new List < DS4Controls > ( ) ;
List < DS4Controls > LYN = new List < DS4Controls > ( ) ;
List < DS4Controls > LYP = new List < DS4Controls > ( ) ;
List < DS4Controls > RXN = new List < DS4Controls > ( ) ;
List < DS4Controls > RXP = new List < DS4Controls > ( ) ;
List < DS4Controls > RYN = new List < DS4Controls > ( ) ;
List < DS4Controls > RYP = new List < DS4Controls > ( ) ;
2014-04-27 21:32:09 +02:00
foreach ( KeyValuePair < DS4Controls , X360Controls > customButton in customButtons )
2014-03-28 02:50:40 +01:00
{
2014-11-01 22:49:22 +01:00
resetToDefaultValue ( customButton . Key , MappedState ) ; // erase default mappings for things that are remapped
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
DS4KeyType keyType = Global . getShiftCustomKeyType ( device , customButton . Key ) ;
2014-05-28 04:49:58 +02:00
int keyvalue = 0 ;
switch ( customButton . Value )
{
case X360Controls . LeftMouse : keyvalue = 256 ; break ;
case X360Controls . RightMouse : keyvalue = 257 ; break ;
case X360Controls . MiddleMouse : keyvalue = 258 ; break ;
case X360Controls . FourthMouse : keyvalue = 259 ; break ;
case X360Controls . FifthMouse : keyvalue = 260 ; break ;
}
if ( keyType . HasFlag ( DS4KeyType . Toggle ) )
{
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-05-28 04:49:58 +02:00
{
if ( ! pressedonce [ keyvalue ] )
{
deviceState . currentClicks . toggle = ! deviceState . currentClicks . toggle ;
test + + ;
pressedonce [ keyvalue ] = true ;
}
deviceState . currentClicks . toggleCount + + ;
}
else // if (test = 1)// && pressedonce[keyvalue])
{
pressedonce [ keyvalue ] = false ;
}
}
2014-10-21 04:31:13 +02:00
switch ( customButton . Value )
{
case X360Controls . A : Cross . Add ( customButton . Key ) ; break ;
case X360Controls . B : Circle . Add ( customButton . Key ) ; break ;
case X360Controls . X : Square . Add ( customButton . Key ) ; break ;
case X360Controls . Y : Triangle . Add ( customButton . Key ) ; break ;
case X360Controls . LB : L1 . Add ( customButton . Key ) ; break ;
case X360Controls . LS : L3 . Add ( customButton . Key ) ; break ;
case X360Controls . RB : R1 . Add ( customButton . Key ) ; break ;
case X360Controls . RS : R3 . Add ( customButton . Key ) ; break ;
case X360Controls . DpadUp : DpadUp . Add ( customButton . Key ) ; break ;
case X360Controls . DpadDown : DpadDown . Add ( customButton . Key ) ; break ;
case X360Controls . DpadLeft : DpadLeft . Add ( customButton . Key ) ; break ;
case X360Controls . DpadRight : DpadRight . Add ( customButton . Key ) ; break ;
case X360Controls . Start : Options . Add ( customButton . Key ) ; break ;
case X360Controls . Guide : PS . Add ( customButton . Key ) ; break ;
case X360Controls . Back : Share . Add ( customButton . Key ) ; break ;
case X360Controls . LXNeg : LXN . Add ( customButton . Key ) ; break ;
case X360Controls . LYNeg : LYN . Add ( customButton . Key ) ; break ;
case X360Controls . RXNeg : RXN . Add ( customButton . Key ) ; break ;
case X360Controls . RYNeg : RYN . Add ( customButton . Key ) ; break ;
case X360Controls . LXPos : LXP . Add ( customButton . Key ) ; break ;
case X360Controls . LYPos : LYP . Add ( customButton . Key ) ; break ;
case X360Controls . RXPos : RXP . Add ( customButton . Key ) ; break ;
case X360Controls . RYPos : RYP . Add ( customButton . Key ) ; break ;
2014-11-21 20:56:31 +01:00
case X360Controls . LT : L2 . Add ( customButton . Key ) ; Console . WriteLine ( "yes" ) ; break ;
2014-10-21 04:31:13 +02:00
case X360Controls . RT : R2 . Add ( customButton . Key ) ; break ;
case X360Controls . LeftMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
deviceState . currentClicks . leftCount + + ;
break ;
case X360Controls . RightMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
deviceState . currentClicks . rightCount + + ;
break ;
case X360Controls . MiddleMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
deviceState . currentClicks . middleCount + + ;
break ;
case X360Controls . FourthMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
deviceState . currentClicks . fourthCount + + ;
break ;
case X360Controls . FifthMouse :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
deviceState . currentClicks . fifthCount + + ;
break ;
case X360Controls . WUP :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
deviceState . currentClicks . wUpCount + + ;
break ;
case X360Controls . WDOWN :
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( customButton . Key , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
deviceState . currentClicks . wDownCount + + ;
break ;
case X360Controls . MouseUp :
if ( MouseDeltaY = = 0 )
{
MouseDeltaY = getMouseMapping ( device , customButton . Key , cState , eState , 0 ) ;
MouseDeltaY = - Math . Abs ( ( MouseDeltaY = = - 2147483648 ? 0 : MouseDeltaY ) ) ;
}
break ;
case X360Controls . MouseDown :
if ( MouseDeltaY = = 0 )
{
MouseDeltaY = getMouseMapping ( device , customButton . Key , cState , eState , 1 ) ;
MouseDeltaY = Math . Abs ( ( MouseDeltaY = = - 2147483648 ? 0 : MouseDeltaY ) ) ;
}
break ;
case X360Controls . MouseLeft :
if ( MouseDeltaX = = 0 )
{
MouseDeltaX = getMouseMapping ( device , customButton . Key , cState , eState , 2 ) ;
MouseDeltaX = - Math . Abs ( ( MouseDeltaX = = - 2147483648 ? 0 : MouseDeltaX ) ) ;
}
break ;
case X360Controls . MouseRight :
if ( MouseDeltaX = = 0 )
{
MouseDeltaX = getMouseMapping ( device , customButton . Key , cState , eState , 3 ) ;
MouseDeltaX = Math . Abs ( ( MouseDeltaX = = - 2147483648 ? 0 : MouseDeltaX ) ) ;
}
break ;
}
2014-04-29 23:56:58 +02:00
}
2014-11-14 20:44:50 +01:00
if ( macroControl [ 0 ] ) MappedState . Cross = true ;
if ( macroControl [ 1 ] ) MappedState . Circle = true ;
if ( macroControl [ 2 ] ) MappedState . Square = true ;
if ( macroControl [ 3 ] ) MappedState . Triangle = true ;
if ( macroControl [ 4 ] ) MappedState . Options = true ;
if ( macroControl [ 5 ] ) MappedState . Share = true ;
if ( macroControl [ 6 ] ) MappedState . DpadUp = true ;
if ( macroControl [ 7 ] ) MappedState . DpadDown = true ;
if ( macroControl [ 8 ] ) MappedState . DpadLeft = true ;
if ( macroControl [ 9 ] ) MappedState . DpadRight = true ;
if ( macroControl [ 10 ] ) MappedState . PS = true ;
if ( macroControl [ 11 ] ) MappedState . L1 = true ;
if ( macroControl [ 12 ] ) MappedState . R1 = true ;
if ( macroControl [ 13 ] ) MappedState . L2 = 255 ;
if ( macroControl [ 14 ] ) MappedState . R2 = 255 ;
if ( macroControl [ 15 ] ) MappedState . L3 = true ;
if ( macroControl [ 16 ] ) MappedState . R3 = true ;
if ( macroControl [ 17 ] ) MappedState . LX = 255 ;
if ( macroControl [ 18 ] ) MappedState . LX = 0 ;
if ( macroControl [ 19 ] ) MappedState . LY = 255 ;
if ( macroControl [ 20 ] ) MappedState . LY = 0 ;
if ( macroControl [ 21 ] ) MappedState . RX = 255 ;
if ( macroControl [ 22 ] ) MappedState . RX = 0 ;
if ( macroControl [ 23 ] ) MappedState . RY = 255 ;
if ( macroControl [ 24 ] ) MappedState . RY = 0 ;
2014-10-21 04:31:13 +02:00
foreach ( DS4Controls dc in Cross )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Cross = true ;
foreach ( DS4Controls dc in Circle )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Circle = true ;
foreach ( DS4Controls dc in Square )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Square = true ;
foreach ( DS4Controls dc in Triangle )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Triangle = true ;
foreach ( DS4Controls dc in L1 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . L1 = true ;
foreach ( DS4Controls dc in L2 )
2014-10-31 00:56:51 +01:00
if ( getByteMapping ( device , dc , cState , eState , tp ) ! = 0 )
MappedState . L2 = getByteMapping ( device , dc , cState , eState , tp ) ;
2014-10-21 04:31:13 +02:00
foreach ( DS4Controls dc in L3 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . L3 = true ;
foreach ( DS4Controls dc in R1 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . R1 = true ;
foreach ( DS4Controls dc in R2 )
2014-10-31 00:56:51 +01:00
if ( getByteMapping ( device , dc , cState , eState , tp ) ! = 0 )
MappedState . R2 = getByteMapping ( device , dc , cState , eState , tp ) ;
2014-10-21 04:31:13 +02:00
foreach ( DS4Controls dc in R3 )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . R3 = true ;
foreach ( DS4Controls dc in DpadUp )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadUp = true ;
foreach ( DS4Controls dc in DpadRight )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadRight = true ;
foreach ( DS4Controls dc in DpadLeft )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadLeft = true ;
foreach ( DS4Controls dc in DpadDown )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . DpadDown = true ;
foreach ( DS4Controls dc in Options )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Options = true ;
foreach ( DS4Controls dc in Share )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . Share = true ;
foreach ( DS4Controls dc in PS )
2014-10-31 00:56:51 +01:00
if ( getBoolMapping ( dc , cState , eState , tp ) )
2014-10-21 04:31:13 +02:00
MappedState . PS = true ;
2014-10-31 00:56:51 +01:00
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . LXNeg ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
LXN . Add ( DS4Controls . LXNeg ) ;
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . LXPos ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
LXP . Add ( DS4Controls . LXPos ) ;
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . LYNeg ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
LYN . Add ( DS4Controls . LYNeg ) ;
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . LYPos ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
LYP . Add ( DS4Controls . LYPos ) ;
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . RXNeg ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
RXN . Add ( DS4Controls . RXNeg ) ;
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . RXPos ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
RXP . Add ( DS4Controls . RXPos ) ;
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . RYNeg ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
RYN . Add ( DS4Controls . RYNeg ) ;
2014-11-01 22:49:22 +01:00
if ( Global . getShiftCustomButton ( device , DS4Controls . RYPos ) = = X360Controls . None )
2014-10-31 00:56:51 +01:00
RYP . Add ( DS4Controls . RYPos ) ;
if ( LXN . Count > 0 | | LXP . Count > 0 )
{
foreach ( DS4Controls dc in LXP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . LX = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
foreach ( DS4Controls dc in LXN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . LX = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
}
else
MappedState . LX = cState . LX ;
if ( LYN . Count > 0 | | LYP . Count > 0 )
{
foreach ( DS4Controls dc in LYN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . LY = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
foreach ( DS4Controls dc in LYP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . LY = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
}
else
MappedState . LY = cState . LY ;
if ( RXN . Count > 0 | | RXP . Count > 0 )
{
foreach ( DS4Controls dc in RXN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . RX = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
foreach ( DS4Controls dc in RXP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . RX = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
}
else
MappedState . RX = cState . RX ;
if ( RYN . Count > 0 | | RYP . Count > 0 )
{
foreach ( DS4Controls dc in RYN )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp ) ) > 5 )
MappedState . RY = getXYAxisMapping ( device , dc , cState , eState , tp ) ;
foreach ( DS4Controls dc in RYP )
if ( Math . Abs ( 127 - getXYAxisMapping ( device , dc , cState , eState , tp , true ) ) > 5 )
MappedState . RY = getXYAxisMapping ( device , dc , cState , eState , tp , true ) ;
}
else
MappedState . RY = cState . RY ;
2014-04-29 23:56:58 +02:00
InputMethods . MoveCursorBy ( MouseDeltaX , MouseDeltaY ) ;
2014-03-28 02:50:40 +01:00
}
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
2014-05-30 22:39:39 +02:00
public static DateTime [ ] mousenow = { DateTime . UtcNow , DateTime . UtcNow , DateTime . UtcNow , DateTime . UtcNow } ;
2014-05-28 21:47:25 +02:00
public static double mvalue = 0 ;
2014-06-26 20:02:01 +02:00
public static int [ ] mouseaccel = new int [ 34 ] ;
public static bool [ ] mousedoublecheck = new bool [ 34 ] ;
2014-06-24 00:27:14 +02:00
private static int getMouseMapping ( int device , DS4Controls control , DS4State cState , DS4StateExposed eState , int mnum )
2014-04-27 21:32:09 +02:00
{
2014-06-26 20:02:01 +02:00
int controlnum = DS4ControltoInt ( control ) ;
double SXD = Global . getSXDeadzone ( device ) ;
double SZD = Global . getSZDeadzone ( device ) ;
2014-11-20 20:03:18 +01:00
int deadzoneL = Math . Max ( ( byte ) 10 , Global . getLSDeadzone ( device ) ) ;
int deadzoneR = Math . Max ( ( byte ) 10 , Global . getRSDeadzone ( device ) ) ;
2014-05-28 21:47:25 +02:00
double value = 0 ;
2014-07-26 01:17:45 +02:00
int speed = Global . getButtonMouseSensitivity ( device ) + 15 ;
2014-06-14 21:14:27 +02:00
double root = 1.002 ;
double divide = 10000d ;
2014-05-30 22:39:39 +02:00
DateTime now = mousenow [ mnum ] ;
2014-04-29 23:56:58 +02:00
switch ( control )
{
case DS4Controls . LXNeg :
2014-11-21 20:56:31 +01:00
if ( cState . LX - 127.5f < - deadzoneL )
value = - ( cState . LX - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
case DS4Controls . LXPos :
2014-11-21 20:56:31 +01:00
if ( cState . LX - 127.5f > deadzoneL )
value = ( cState . LX - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
case DS4Controls . RXNeg :
2014-11-21 20:56:31 +01:00
if ( cState . RX - 127.5f < - deadzoneR )
value = - ( cState . RX - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
case DS4Controls . RXPos :
2014-11-21 20:56:31 +01:00
if ( cState . RX - 127.5f > deadzoneR )
value = ( cState . RX - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
case DS4Controls . LYNeg :
2014-11-21 20:56:31 +01:00
if ( cState . LY - 127.5f < - deadzoneL )
value = - ( cState . LY - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
case DS4Controls . LYPos :
2014-11-21 20:56:31 +01:00
if ( cState . LY - 127.5f > deadzoneL )
value = ( cState . LY - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
case DS4Controls . RYNeg :
2014-11-21 20:56:31 +01:00
if ( cState . RY - 127.5f < - deadzoneR )
value = - ( cState . RY - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
case DS4Controls . RYPos :
2014-11-21 20:56:31 +01:00
if ( cState . RY - 127.5f > deadzoneR )
value = ( cState . RY - 127.5f ) / 2550d * speed ;
2014-07-26 01:17:45 +02:00
break ;
2014-06-14 21:14:27 +02:00
case DS4Controls . Share : value = ( cState . Share ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . Options : value = ( cState . Options ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . L1 : value = ( cState . L1 ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . R1 : value = ( cState . R1 ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . L3 : value = ( cState . L3 ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . R3 : value = ( cState . R3 ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . DpadUp : value = ( cState . DpadUp ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . DpadDown : value = ( cState . DpadDown ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . DpadLeft : value = ( cState . DpadLeft ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . DpadRight : value = ( cState . DpadRight ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . PS : value = ( cState . PS ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . Cross : value = ( cState . Cross ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . Square : value = ( cState . Square ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . Triangle : value = ( cState . Triangle ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; break ;
case DS4Controls . Circle : value = ( cState . Circle ? Math . Pow ( root + speed / divide , 100 ) - 1 : 0 ) ; 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 ;
2014-04-29 23:56:58 +02:00
}
2014-06-24 00:27:14 +02:00
if ( eState ! = null )
switch ( control )
{
2014-06-26 20:02:01 +02:00
case DS4Controls . GyroXPos : return ( byte ) ( eState . GyroX > SXD * 7500 ?
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
Math . Pow ( root + speed / divide , eState . GyroX / 62 ) : 0 ) ;
2014-06-26 20:02:01 +02:00
case DS4Controls . GyroXNeg : return ( byte ) ( eState . GyroX < - SXD * 7500 ?
2014-06-24 00:27:14 +02:00
Math . Pow ( root + speed / divide , - eState . GyroX / 48 ) : 0 ) ;
2014-06-26 20:02:01 +02:00
case DS4Controls . GyroZPos : return ( byte ) ( eState . GyroZ > SZD * 7500 ?
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
Math . Pow ( root + speed / divide , eState . GyroZ / 62 ) : 0 ) ;
2014-06-26 20:02:01 +02:00
case DS4Controls . GyroZNeg : return ( byte ) ( eState . GyroZ < - SZD * 7500 ?
Shift modifier: Hold an action to use another set of controls, if nothing is set to the shifted control, in falls back to the default action
View input of controls in profiles, see exactly when a deadzone is passed and check the input delay for controllers (special thanks to jhebbel), click the on sixaxis panel
Click the Empty text on in the lightbar box to copy the lightbar color from full to empty.
While opened, option to keep the window size after closing the profile's settings
Old profiles are automatically upgraded if it's missing new settings, such as how colors are now saved, sixaxis deadzones, and shift controls
Other UI changes for profile settings, flipped touchpad and other settings boxes
Others:
Fix for when clicking the semicolon in the select an action screen
Fix assigning Sixaxis action to a key
minor UI changes and bug fixes, such as auto resize of the log listview
DS4Updater: Also now works for the new numbering system, can read the version number right from the exe instead of in profiles.xml, UI additions to better notify users of errors, Bug fixes for non-portable users
2014-07-07 21:22:42 +02:00
Math . Pow ( root + speed / divide , - eState . GyroZ / 62 ) : 0 ) ;
2014-06-24 00:27:14 +02:00
}
2014-11-20 20:03:18 +01:00
bool LXChanged = ( Math . Abs ( 127 - cState . LX ) < deadzoneL ) ;
bool LYChanged = ( Math . Abs ( 127 - cState . LY ) < deadzoneL ) ;
bool RXChanged = ( Math . Abs ( 127 - cState . RX ) < deadzoneR ) ;
bool RYChanged = ( Math . Abs ( 127 - cState . RY ) < deadzoneR ) ;
2014-11-21 20:56:31 +01:00
bool contains = ( control . ToString ( ) . Contains ( "LX" ) | |
control . ToString ( ) . Contains ( "LY" ) | |
control . ToString ( ) . Contains ( "RX" ) | |
control . ToString ( ) . Contains ( "RY" ) ) ;
2014-05-28 21:47:25 +02:00
if ( LXChanged | | LYChanged | | RXChanged | | RYChanged )
now = DateTime . UtcNow ;
2014-06-26 20:02:01 +02:00
if ( Global . getMouseAccel ( device ) )
{
if ( value > 0 )
mouseaccel [ controlnum ] + + ;
else if ( ! mousedoublecheck [ controlnum ] )
mouseaccel [ controlnum ] = 0 ;
mousedoublecheck [ controlnum ] = value ! = 0 ;
if ( mouseaccel [ controlnum ] > 1000 )
value * = ( double ) Math . Min ( 2000 , ( mouseaccel [ controlnum ] ) ) / 1000d ;
}
2014-11-21 20:56:31 +01:00
if ( value ! = 0 )
if ( contains & & value < = 1 & & value ! = 0 )
2014-05-28 21:47:25 +02:00
{
2014-06-14 21:14:27 +02:00
if ( now > = mousenow [ mnum ] + TimeSpan . FromMilliseconds ( ( 1 - value ) * 500 ) )
2014-05-28 21:47:25 +02:00
{
2014-05-30 22:39:39 +02:00
mousenow [ mnum ] = now ;
2014-05-28 21:47:25 +02:00
return 1 ;
}
else
return 0 ;
}
else
2014-06-14 21:14:27 +02:00
return ( int ) value ;
2014-11-21 20:56:31 +01:00
return 0 ;
2014-04-27 21:32:09 +02:00
}
2014-04-29 23:56:58 +02:00
2014-03-28 02:50:40 +01:00
public static bool compare ( byte b1 , byte b2 )
{
if ( Math . Abs ( b1 - b2 ) > 10 )
{
return false ;
}
return true ;
}
2014-04-27 21:32:09 +02:00
2014-10-31 00:56:51 +01:00
public static byte getByteMapping ( int device , DS4Controls control , DS4State cState , DS4StateExposed eState , Mouse tp )
2014-03-28 02:50:40 +01:00
{
2014-06-26 20:02:01 +02:00
double SXD = Global . getSXDeadzone ( device ) ;
double SZD = Global . getSZDeadzone ( device ) ;
2014-03-28 02:50:40 +01:00
switch ( control )
{
case DS4Controls . Share : return ( byte ) ( cState . Share ? 255 : 0 ) ;
case DS4Controls . Options : return ( byte ) ( cState . Options ? 255 : 0 ) ;
case DS4Controls . L1 : return ( byte ) ( cState . L1 ? 255 : 0 ) ;
case DS4Controls . R1 : return ( byte ) ( cState . R1 ? 255 : 0 ) ;
case DS4Controls . L3 : return ( byte ) ( cState . L3 ? 255 : 0 ) ;
case DS4Controls . R3 : return ( byte ) ( cState . R3 ? 255 : 0 ) ;
case DS4Controls . DpadUp : return ( byte ) ( cState . DpadUp ? 255 : 0 ) ;
case DS4Controls . DpadDown : return ( byte ) ( cState . DpadDown ? 255 : 0 ) ;
case DS4Controls . DpadLeft : return ( byte ) ( cState . DpadLeft ? 255 : 0 ) ;
case DS4Controls . DpadRight : return ( byte ) ( cState . DpadRight ? 255 : 0 ) ;
case DS4Controls . PS : return ( byte ) ( cState . PS ? 255 : 0 ) ;
case DS4Controls . Cross : return ( byte ) ( cState . Cross ? 255 : 0 ) ;
case DS4Controls . Square : return ( byte ) ( cState . Square ? 255 : 0 ) ;
case DS4Controls . Triangle : return ( byte ) ( cState . Triangle ? 255 : 0 ) ;
case DS4Controls . Circle : return ( byte ) ( cState . Circle ? 255 : 0 ) ;
2014-11-01 22:49:22 +01:00
case DS4Controls . TouchLeft : return ( byte ) ( tp ! = null & & tp . leftDown ? 255 : 0 ) ;
case DS4Controls . TouchRight : return ( byte ) ( tp ! = null & & tp . rightDown ? 255 : 0 ) ;
case DS4Controls . TouchMulti : return ( byte ) ( tp ! = null & & tp . multiDown ? 255 : 0 ) ;
case DS4Controls . TouchUpper : return ( byte ) ( tp ! = null & & tp . upperDown ? 255 : 0 ) ;
2014-11-15 22:54:14 +01:00
case DS4Controls . LXNeg : return ( byte ) ( cState . LX - 127.5f > 0 ? 0 : - ( cState . LX - 127.5f ) * 2 ) ;
case DS4Controls . LYNeg : return ( byte ) ( cState . LY - 127.5f > 0 ? 0 : - ( cState . LY - 127.5f ) * 2 ) ;
case DS4Controls . RXNeg : return ( byte ) ( cState . RX - 127.5f > 0 ? 0 : - ( cState . RX - 127.5f ) * 2 ) ;
case DS4Controls . RYNeg : return ( byte ) ( cState . RY - 127.5f > 0 ? 0 : - ( cState . RY - 127.5f ) * 2 ) ;
case DS4Controls . LXPos : return ( byte ) ( cState . LX - 127.5f < 0 ? 0 : ( cState . LX - 127.5f ) * 2 ) ;
case DS4Controls . LYPos : return ( byte ) ( cState . LY - 127.5f < 0 ? 0 : ( cState . LY - 127.5f ) * 2 ) ;
case DS4Controls . RXPos : return ( byte ) ( cState . RX - 127.5f < 0 ? 0 : ( cState . RX - 127.5f ) * 2 ) ;
case DS4Controls . RYPos : return ( byte ) ( cState . RY - 127.5f < 0 ? 0 : ( cState . RY - 127.5f ) * 2 ) ;
case DS4Controls . L2 : return cState . L2 ;
case DS4Controls . R2 : return cState . R2 ;
2014-10-31 00:56:51 +01:00
case DS4Controls . GyroXPos : return ( byte ) ( eState . GyroX > SXD * 7500 ? Math . Min ( 255 , eState . GyroX / 31 ) : 0 ) ;
case DS4Controls . GyroXNeg : return ( byte ) ( eState . GyroX < - SXD * 7500 ? Math . Min ( 255 , - eState . GyroX / 31 ) : 0 ) ;
case DS4Controls . GyroZPos : return ( byte ) ( eState . GyroZ > SZD * 7500 ? Math . Min ( 255 , eState . GyroZ / 31 ) : 0 ) ;
case DS4Controls . GyroZNeg : return ( byte ) ( eState . GyroZ < - SZD * 7500 ? Math . Min ( 255 , - eState . GyroZ / 31 ) : 0 ) ;
2014-11-15 22:54:14 +01:00
case DS4Controls . SwipeUp : return ( byte ) ( tp ! = null ? tp . swipeUpB : 0 ) ;
case DS4Controls . SwipeDown : return ( byte ) ( tp ! = null ? tp . swipeDownB : 0 ) ;
case DS4Controls . SwipeLeft : return ( byte ) ( tp ! = null ? tp . swipeLeftB : 0 ) ;
case DS4Controls . SwipeRight : return ( byte ) ( tp ! = null ? tp . swipeRightB : 0 ) ;
2014-04-27 21:32:09 +02:00
}
2014-03-28 02:50:40 +01:00
return 0 ;
}
2014-10-31 00:56:51 +01:00
public static bool getBoolMapping ( DS4Controls control , DS4State cState , DS4StateExposed eState , Mouse tp )
2014-03-28 02:50:40 +01:00
{
2014-11-15 22:54:14 +01:00
//if (control == DS4Controls.Up)
//Cons
2014-03-28 02:50:40 +01:00
switch ( control )
{
case DS4Controls . Share : return cState . Share ;
case DS4Controls . Options : return cState . Options ;
case DS4Controls . L1 : return cState . L1 ;
case DS4Controls . R1 : return cState . R1 ;
case DS4Controls . L3 : return cState . L3 ;
case DS4Controls . R3 : return cState . R3 ;
case DS4Controls . DpadUp : return cState . DpadUp ;
case DS4Controls . DpadDown : return cState . DpadDown ;
case DS4Controls . DpadLeft : return cState . DpadLeft ;
case DS4Controls . DpadRight : return cState . DpadRight ;
case DS4Controls . PS : return cState . PS ;
case DS4Controls . Cross : return cState . Cross ;
case DS4Controls . Square : return cState . Square ;
case DS4Controls . Triangle : return cState . Triangle ;
case DS4Controls . Circle : return cState . Circle ;
2014-10-31 20:00:15 +01:00
case DS4Controls . TouchLeft : return ( tp ! = null ? tp . leftDown : false ) ;
case DS4Controls . TouchRight : return ( tp ! = null ? tp . rightDown : false ) ;
case DS4Controls . TouchMulti : return ( tp ! = null ? tp . multiDown : false ) ;
case DS4Controls . TouchUpper : return ( tp ! = null ? tp . upperDown : false ) ;
2014-05-21 23:42:25 +02:00
case DS4Controls . LXNeg : return cState . LX < 127 - 55 ;
case DS4Controls . LYNeg : return cState . LY < 127 - 55 ;
case DS4Controls . RXNeg : return cState . RX < 127 - 55 ;
case DS4Controls . RYNeg : return cState . RY < 127 - 55 ;
case DS4Controls . LXPos : return cState . LX > 127 + 55 ;
case DS4Controls . LYPos : return cState . LY > 127 + 55 ;
case DS4Controls . RXPos : return cState . RX > 127 + 55 ;
case DS4Controls . RYPos : return cState . RY > 127 + 55 ;
2014-03-28 02:50:40 +01:00
case DS4Controls . L2 : return cState . L2 > 100 ;
case DS4Controls . R2 : return cState . R2 > 100 ;
2014-10-31 00:56:51 +01:00
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 ;
2014-11-15 22:54:14 +01:00
case DS4Controls . SwipeUp : return ( tp ! = null & & tp . swipeUp ) ;
case DS4Controls . SwipeDown : return ( tp ! = null & & tp . swipeDown ) ;
case DS4Controls . SwipeLeft : return ( tp ! = null & & tp . swipeLeft ) ;
case DS4Controls . SwipeRight : return ( tp ! = null & & tp . swipeRight ) ;
2014-03-28 02:50:40 +01:00
}
return false ;
}
2014-10-31 00:56:51 +01:00
public static byte getXYAxisMapping ( int device , DS4Controls control , DS4State cState , DS4StateExposed eState , Mouse tp , bool alt = false )
2014-03-28 02:50:40 +01:00
{
byte trueVal = 0 ;
byte falseVal = 127 ;
2014-06-26 20:02:01 +02:00
double SXD = Global . getSXDeadzone ( device ) ;
double SZD = Global . getSZDeadzone ( device ) ;
2014-03-28 02:50:40 +01:00
if ( alt )
trueVal = 255 ;
switch ( control )
{
case DS4Controls . Share : return ( byte ) ( cState . Share ? trueVal : falseVal ) ;
case DS4Controls . Options : return ( byte ) ( cState . Options ? trueVal : falseVal ) ;
case DS4Controls . L1 : return ( byte ) ( cState . L1 ? trueVal : falseVal ) ;
case DS4Controls . R1 : return ( byte ) ( cState . R1 ? trueVal : falseVal ) ;
case DS4Controls . L3 : return ( byte ) ( cState . L3 ? trueVal : falseVal ) ;
case DS4Controls . R3 : return ( byte ) ( cState . R3 ? trueVal : falseVal ) ;
case DS4Controls . DpadUp : return ( byte ) ( cState . DpadUp ? trueVal : falseVal ) ;
case DS4Controls . DpadDown : return ( byte ) ( cState . DpadDown ? trueVal : falseVal ) ;
case DS4Controls . DpadLeft : return ( byte ) ( cState . DpadLeft ? trueVal : falseVal ) ;
case DS4Controls . DpadRight : return ( byte ) ( cState . DpadRight ? trueVal : falseVal ) ;
case DS4Controls . PS : return ( byte ) ( cState . PS ? trueVal : falseVal ) ;
case DS4Controls . Cross : return ( byte ) ( cState . Cross ? trueVal : falseVal ) ;
case DS4Controls . Square : return ( byte ) ( cState . Square ? trueVal : falseVal ) ;
case DS4Controls . Triangle : return ( byte ) ( cState . Triangle ? trueVal : falseVal ) ;
case DS4Controls . Circle : return ( byte ) ( cState . Circle ? trueVal : falseVal ) ;
2014-11-01 22:49:22 +01:00
case DS4Controls . TouchLeft : return ( byte ) ( tp ! = null & & tp . leftDown ? trueVal : falseVal ) ;
case DS4Controls . TouchRight : return ( byte ) ( tp ! = null & & tp . rightDown ? trueVal : falseVal ) ;
case DS4Controls . TouchMulti : return ( byte ) ( tp ! = null & & tp . multiDown ? trueVal : falseVal ) ;
case DS4Controls . TouchUpper : return ( byte ) ( tp ! = null & & tp . upperDown ? trueVal : falseVal ) ;
2014-11-15 22:54:14 +01:00
case DS4Controls . L2 : if ( alt ) return ( byte ) ( 127.5f + cState . L2 / 2f ) ; else return ( byte ) ( 127.5f - cState . L2 / 2f ) ;
case DS4Controls . R2 : if ( alt ) return ( byte ) ( 127.5f + cState . R2 / 2f ) ; else return ( byte ) ( 127.5f - cState . R2 / 2f ) ;
case DS4Controls . SwipeUp : if ( alt ) return ( byte ) ( tp ! = null ? 127.5f + tp . swipeUpB / 2f : 0 ) ; else return ( byte ) ( tp ! = null ? 127.5f - tp . swipeUpB / 2f : 0 ) ;
case DS4Controls . SwipeDown : if ( alt ) return ( byte ) ( tp ! = null ? 127.5f + tp . swipeDownB / 2f : 0 ) ; else return ( byte ) ( tp ! = null ? 127.5f - tp . swipeDownB / 2f : 0 ) ;
case DS4Controls . SwipeLeft : if ( alt ) return ( byte ) ( tp ! = null ? 127.5f + tp . swipeLeftB / 2f : 0 ) ; else return ( byte ) ( tp ! = null ? 127.5f - tp . swipeLeftB / 2f : 0 ) ;
case DS4Controls . SwipeRight : if ( alt ) return ( byte ) ( tp ! = null ? 127.5f + tp . swipeRightB / 2f : 0 ) ; else return ( byte ) ( tp ! = null ? 127.5f - tp . swipeRightB / 2f : 0 ) ;
2014-10-31 00:56:51 +01:00
case DS4Controls . GyroXPos : if ( eState . GyroX > SXD * 7500 )
if ( alt ) return ( byte ) Math . Min ( 255 , 127 + eState . GyroX / 62 ) ; else return ( byte ) Math . Max ( 0 , 127 - eState . GyroX / 62 ) ;
else return falseVal ;
case DS4Controls . GyroXNeg : if ( eState . GyroX < - SXD * 7500 )
if ( alt ) return ( byte ) Math . Min ( 255 , 127 + - eState . GyroX / 62 ) ; else return ( byte ) Math . Max ( 0 , 127 - - eState . GyroX / 62 ) ;
else return falseVal ;
case DS4Controls . GyroZPos : if ( eState . GyroZ > SZD * 7500 )
if ( alt ) return ( byte ) Math . Min ( 255 , 127 + eState . GyroZ / 62 ) ; else return ( byte ) Math . Max ( 0 , 127 - eState . GyroZ / 62 ) ;
else return falseVal ;
case DS4Controls . GyroZNeg : if ( eState . GyroZ < - SZD * 7500 )
if ( alt ) return ( byte ) Math . Min ( 255 , 127 + - eState . GyroZ / 62 ) ; else return ( byte ) Math . Max ( 0 , 127 - - eState . GyroZ / 62 ) ;
else return falseVal ;
}
2014-03-28 02:50:40 +01:00
if ( ! alt )
{
switch ( control )
{
case DS4Controls . LXNeg : return cState . LX ;
case DS4Controls . LYNeg : return cState . LY ;
case DS4Controls . RXNeg : return cState . RX ;
case DS4Controls . RYNeg : return cState . RY ;
case DS4Controls . LXPos : return ( byte ) ( 255 - cState . LX ) ;
case DS4Controls . LYPos : return ( byte ) ( 255 - cState . LY ) ;
2014-05-22 00:19:07 +02:00
case DS4Controls . RXPos : return ( byte ) ( 255 - cState . RX ) ;
2014-03-28 02:50:40 +01:00
case DS4Controls . RYPos : return ( byte ) ( 255 - cState . RY ) ;
}
}
else
{
switch ( control )
{
case DS4Controls . LXNeg : return ( byte ) ( 255 - cState . LX ) ;
case DS4Controls . LYNeg : return ( byte ) ( 255 - cState . LY ) ;
2014-05-22 00:19:07 +02:00
case DS4Controls . RXNeg : return ( byte ) ( 255 - cState . RX ) ;
2014-03-28 02:50:40 +01:00
case DS4Controls . RYNeg : return ( byte ) ( 255 - cState . RY ) ;
case DS4Controls . LXPos : return cState . LX ;
case DS4Controls . LYPos : return cState . LY ;
case DS4Controls . RXPos : return cState . RX ;
case DS4Controls . RYPos : return cState . RY ;
}
}
return 0 ;
}
//Returns false for any bool,
//if control is one of the xy axis returns 127
//if its a trigger returns 0
public static void resetToDefaultValue ( DS4Controls control , DS4State cState )
{
switch ( control )
{
case DS4Controls . Share : cState . Share = false ; break ;
case DS4Controls . Options : cState . Options = false ; break ;
case DS4Controls . L1 : cState . L1 = false ; break ;
case DS4Controls . R1 : cState . R1 = false ; break ;
case DS4Controls . L3 : cState . L3 = false ; break ;
case DS4Controls . R3 : cState . R3 = false ; break ;
case DS4Controls . DpadUp : cState . DpadUp = false ; break ;
case DS4Controls . DpadDown : cState . DpadDown = false ; break ;
case DS4Controls . DpadLeft : cState . DpadLeft = false ; break ;
case DS4Controls . DpadRight : cState . DpadRight = false ; break ;
case DS4Controls . PS : cState . PS = false ; break ;
case DS4Controls . Cross : cState . Cross = false ; break ;
case DS4Controls . Square : cState . Square = false ; break ;
case DS4Controls . Triangle : cState . Triangle = false ; break ;
case DS4Controls . Circle : cState . Circle = false ; break ;
case DS4Controls . LXNeg : cState . LX = 127 ; break ;
case DS4Controls . LYNeg : cState . LY = 127 ; break ;
case DS4Controls . RXNeg : cState . RX = 127 ; break ;
case DS4Controls . RYNeg : cState . RY = 127 ; break ;
case DS4Controls . LXPos : cState . LX = 127 ; break ;
case DS4Controls . LYPos : cState . LY = 127 ; break ;
case DS4Controls . RXPos : cState . RX = 127 ; break ;
case DS4Controls . RYPos : cState . RY = 127 ; break ;
case DS4Controls . L2 : cState . L2 = 0 ; break ;
case DS4Controls . R2 : cState . R2 = 0 ; break ;
}
}
// Arthritis mode, compensate for cumulative pressure F=kx on the triggers by allowing the user to remap the entire trigger to just the initial portion.
private static byte [ , ] leftTriggerMap = new byte [ 4 , 256 ] , rightTriggerMap = new byte [ 4 , 256 ] ;
private static double [ ] leftTriggerMiddle = new double [ 4 ] , // linear trigger remapping, 0.5 is in the middle of 0 and 255 from the native controller.
oldLeftTriggerMiddle = new double [ 4 ] ,
rightTriggerMiddle = new double [ 4 ] , oldRightTriggerMiddle = new double [ 4 ] ;
private static void initializeTriggerMap ( byte [ , ] map , double triggerMiddle , int deviceNum )
{
double midpoint = 256.0 * triggerMiddle ;
for ( uint x = 0 ; x < = 255 ; x + + )
{
double mapped ;
if ( x < midpoint ) // i.e. with standard 0.5, 0..127->0..127, etc.; with 0.25, 0..63->0..127 and 64..255->128..255\
mapped = ( x * 0.5 / triggerMiddle ) ;
else
mapped = 128.0 + 128.0 * ( x - midpoint ) / ( 256.0 - midpoint ) ;
map [ deviceNum , x ] = ( byte ) mapped ;
}
}
public static byte mapLeftTrigger ( byte orig , int deviceNum )
{
leftTriggerMiddle [ deviceNum ] = Global . getLeftTriggerMiddle ( deviceNum ) ;
if ( leftTriggerMiddle [ deviceNum ] ! = oldLeftTriggerMiddle [ deviceNum ] )
{
oldLeftTriggerMiddle [ deviceNum ] = leftTriggerMiddle [ deviceNum ] ;
initializeTriggerMap ( leftTriggerMap , leftTriggerMiddle [ deviceNum ] , deviceNum ) ;
}
return leftTriggerMap [ deviceNum , orig ] ;
}
public static byte mapRightTrigger ( byte orig , int deviceNum )
{
rightTriggerMiddle [ deviceNum ] = Global . getRightTriggerMiddle ( deviceNum ) ;
if ( rightTriggerMiddle [ deviceNum ] ! = oldRightTriggerMiddle [ deviceNum ] )
{
oldRightTriggerMiddle [ deviceNum ] = rightTriggerMiddle [ deviceNum ] ;
initializeTriggerMap ( rightTriggerMap , rightTriggerMiddle [ deviceNum ] , deviceNum ) ;
}
return rightTriggerMap [ deviceNum , orig ] ;
}
}
}