Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freepie equivalent of swallowkeys from glovepie #139

Open
drowhunter opened this issue Dec 4, 2017 · 7 comments
Open

Freepie equivalent of swallowkeys from glovepie #139

drowhunter opened this issue Dec 4, 2017 · 7 comments

Comments

@drowhunter
Copy link
Contributor

since freepie is the spiritual successor to glovepie. There is a feature that i sorely miss. The ability to remap keyboard keys and block the input .

for example when pressing Key.B it would send key.W but "key.B" would not go through, just "key.W"

does anyone know how to accomplish this? I tried using using a low level hook but not sure how you would do it with c#

@AndersMalmgren
Copy link
Owner

I looked into this a long time ago, didn't find a working solution back then. But if glovepie can do it, it's possible :)

@drowhunter
Copy link
Contributor Author

i looked into it a while ago myself. i kind of had it working the issue was the Low level keyboard hook works by intercepting the key using standard windows messaing . which works as long as the application is reading the keyboard using directinput.

however if the application reads the keyboard directly using rawinput then it bypasses that altogether

truth is this may have been an issue in glovepie as well i never actually checked to see if swallowkeys worked in games that use rawinput. i might try that tonight

@AndersMalmgren
Copy link
Owner

Cool, how did it go?

@drowhunter
Copy link
Contributor Author

oh, i havent had time to investigate yet. I'll find a copy of glovepie and try it in rawinput games to see if swallowkeys is actually able to block the keys. If not , i guess the solution i had come up with was promising .

maybe ill dig up the old code i wrote to see if theres a way to get it working..i was thinking about maybe a rawinput version of the keyboard plugin.

as i said the games that failed blocking keys were games like streetfighter 4/5 and mame because they read the keyboard directly

@Frenchy62620
Copy link

Frenchy62620 commented Jan 5, 2018

the hook keyboard is done!! file to install in FeePIE folder (its the hooker process)
InputTrackingExample.zip

so the solution is to create an another little process which hooks keyboard (and mouse if you adapt coding). Inside FreePie, you just see the branch Hooking i have forked. I give you an example of script but the coding is easy to understand. I am using memory shared to dialog between the 2 process

Hooker.keyboard.swallow(["alpha","-ABCDEF"] hook all alph keys except A to F

the key sended byt setPressed bypasses always the Hook

#just E and F key Hooked
if starting:
Hooker.keyboard.swallow(["EF"])

if speech.said("start hook"):
Hooker.keyboard.setHook(True)

if speech.said("stop hook"):
Hooker.keyboard.setHook(False)

if Keyboard.IsPressed(Key.F):
speech.say("Key F")

if Hooker.keyboard.Ispressed(Key.E):
keyboard.setPressed(Key.D)

here its the project inputTracking done in VS 2017 but totally compatible in VS 2015
InputTrackingProject.zip

@AndersMalmgren
Copy link
Owner

Nice job, You dont need it to be a seperate exe you can spawn and manage processes from within a ,NET app. But you need to communicate with it through shared memory just like you do.

hmmm.. Hooker, I think we should find a better name :P

@Frenchy62620
Copy link

Frenchy62620 commented Jan 5, 2018

Hi anders.. its just a test, i have tried to create Thread and launch, but no result i think the Hook has an limited effect within child thread what are you thinking about to spawn and manage process within .net app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants