Is it possible to intercept controller inputs?

I'm not very familiar with C++ or it's libraries, so I was hoping someone here could give me an idea of how feasible this is.

I'd like to be able to know if it's possible to detect a controller input (lets say an XBox One controller), block the input from being detected by the system (or a specific application / game), and give the system (or game) a completely different input (or series of inputs) instead.

I'd greatly appreciate any help at all, even a push in the right direction.
Last edited on
This would be quite difficult to achieve on your own, considering the fact that this is something that has been already been done in many different flavors.

I remember using this for a snes controller, but I am not sure if it can use joysticks... https://github.com/AntiMicro/antimicro/releases

And here is an old program for xbox controllers, but it may be severly out of date to use an xbox one from all that I know https://www.softpedia.com/get/System/System-Miscellaneous/Xpadder.shtml
Thanks for the links!
its a 2 part problem. I think you need these steps:
1) read the controller input yourself
2) write a device driver that appears to be a hardware controller but is really software.

then #2 has 2 modes -- somehow you tell it to pass-through and it will read the controller itself and pass those values on to the target. Then set it from pass-through to override mode, and it will ignore the controller and feed its own (recorded command session? ) data back to the target.

then you tell the target program to use the controller defined by your driver.

Its been so long since I have done this that all I can give you are the rough approach though. As in the last time I tried this kind of thing, the controller plugged into a serial (not usb) port.
Last edited on
I appreciate your suggestions.

Intercepting the input in any way will be the ultimate challenge for me. I think the most realistic solution for me is to use an existing library. Either as you suggested, some kind of library that creates a virtual controller... or some library that can intercept it before it reaches the system.

I found this so far: https://github.com/oblitum/Interception

... but I'll have to wait until the weekend before being able to figure out if it'll even be of use. I like your suggestion, and I'll definitely need to look into it. The issue there, is that if the game already recognizes the controller as a valid input device, then I would have to deal with that somehow.

To give some context of what I want to do, my goal is to remap the move set of "Devil May Cry 5" into a control scheme similar to "DmC: Devil May Cry". The actual implementation of this "should" be straight forward, I hope. If "R2" and 'Square" are pressed together, then it will check a map and perform some additional logic and call "D-Pad left", followed by "Square", but only if the current style is not on "Gunslinger".

Thanks again for your suggestion. It gives me additional things to google into. I'm confident there must be someone out there that has already created a library that could give me massive shortcuts.
Last edited on
most modern games allow you to choose your controller from any that the OS recognizes as valid, at least on windows. Consoles want only their own certified type, of course. If you can register your program so the game can see it and choose it, the problem should be solved.

what you are talking about sounds like a 'bot' program. People use these to do earned repetitive content (eg kill 1000 orcs in this small area) or to farm money to sell online (typically get banned from game if caught). Speaking of which online games detect bots .... doing the same thing too many times with no randomization will get you a ban-hammer in many online games. Heh... a friend of mine made a simple actuator to mash a button on his controller for him while at work all day... but that was a local not online game.

you can google for bots and source code, see if you can find a starter.
Last edited on
Now that you mention it... Devil May Cry 5 will have some sort of multiplayer mode, which hasn't been revealed yet. I'm not too concerned though. Just like Doom, I'll forever see it as a single player game.

The goal of this program is just to simplify the controls to have a lower learning curve. I wouldn't call it a bot, personally... since it's still driven by user inputs. It's just going to translate those inputs into what the game expects to see.


You've given me hope though. If I can completely ignore the "interception" part of my problem, then that should make things much easier.
If "R2" and 'Square" are pressed together, then it will check a map and perform some additional logic and call "D-Pad left", followed by "Square"

I'd be surprised if you could translate gestures without unacceptable latency.

Typically, an input driver will read a series of snapshots of the controller state and stick that into a buffer that the game can postprocess into an action. Only once an action is recognized, the game can react in the next frame.

One example of a control gesture could be "smack the stick to slide". Unless the user is very angry, the process of moving the stick and recognizing the slide might take more than one frame. This is just fine if the game received the input immediately, but you have to translate it first. Since the game needs to post-process its input itself, this process may result in several frames of input lag.

A simple control state remapping won't have this problem. Consider, for example, a game controller that has a built-in "rapid-fire" button - you push an extra button or whatever and the controller emits trigger pull signals inhumanly fast. There is no requirement to recognize simultaneous presses or anything.
Last edited on
I said bot to give you a search term, not to define what you are doing. If you want to write a program that plays a game for you (even at at a simple enhancement level, not full automation) you are looking for that kind of code, and that is the term that will bring back fruit in google. :)

Ah, gotcha. Thanks for the suggestion.

I don't know much about control state remapping. Would that allow for conditional logic? Hold a variable in memory, and based on the buttons being held down... a script can determine what buttons should be output?
An example of "remapping" would be swapping two buttons on the game-pad - make A look like B and B look like A. You've certainly done this before, whenever you go into the "controls" menu to change which buttons do what.

You can definitely do stuff conditionally, but the longer you spend processing input, the longer the game has to wait to see it. Your processing can't wait for the user: it has to happen quickly, or you'll get input lag.
Last edited on
poteto thanks for the liks. that was usefull..........
Last edited on
Topic archived. No new replies allowed.