steam-deck-tools icon indicating copy to clipboard operation
steam-deck-tools copied to clipboard

Emulate long press with C#

Open ayyoubmiftah opened this issue 2 years ago • 4 comments

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 avatar Mar 09 '23 09:03 ayyoubmiftah

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

ayyoubmiftah avatar Mar 14 '23 09:03 ayyoubmiftah

@ayufan Any news ?

ayyoubmiftah avatar Mar 20 '23 10:03 ayyoubmiftah

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 avatar Mar 20 '23 10:03 ayyoubmiftah

@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 )

ayyoubmiftah avatar Mar 21 '23 16:03 ayyoubmiftah