ayufan / steam-deck-tools

(Windows) Steam Deck Tools - Fan, Overlay, Power Control and Steam Controller for Windows
https://steam-deck-tools.ayufan.dev
Other
937 stars 67 forks source link

Emulate long press with C# #85

Open ayyoubmiftah opened 1 year ago

ayyoubmiftah commented 1 year ago

How I can emulate Long press key with long press in steam deck button for example : long press in R1 simulate long press in (and if I released my finger in R1 automatically released )

ayyoubmiftah commented 1 year ago

@ayufan I found a solution with https://github.com/AntiMicroX/antimicrox it can do a long press emulation and work Great with SDT

ayyoubmiftah commented 1 year ago

@ayufan Any news ?

ayyoubmiftah commented 1 year ago

I'm stuck with antimicrox with steam deck https://github.com/ayufan/steam-deck-tools/issues/85#issuecomment-1467745743 Steam deck tools need just this feature (long press while click in btn?) and cutumize btn just like L4,L5,L6,L7 with desktop mode and will be perfect

ayyoubmiftah commented 1 year ago

@ayufan problem is solved . if you are familiar to c# work with this function :

[DllImport("user32.dll", SetLastError = true)] static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);

public static void KeyPress(int keycode, int delay = 0) { keybd_event((byte)keycode, 0x0, 0, 0);// presses System.Threading.Thread.Sleep(delay); keybd_event((byte)keycode, 0x0, 2, 0); //releases }

or used like this

if(c.CUSTOMBTN.justPressed()) keybd_event((byte)keycode, 0x0, 0, 0); else if(c.CUSTOMBTN.pressed()) keybd_event((byte)keycode, 0x0, 2, 0);

and finally you can make a long click 👍 🏆 (Now just waiting for custom butons/profiles with interface )