How did it happen
In the long hidden past
Was the world just like ours
Once beautiful, but every flower dies ...
- All Mankind, "Break the spell"
The plot of the story is trivial. Once upon a time, in a distant galaxy there was a great game called “Fifa”. It would have remained so if its bad people from EA did not want to finally kill the keyboard controls in the name of gamepads in 2010.
I decided to
take retribution in the name of the moon to return the normal keyboard controls back. Chronicles of beaver fighting with a donkey can be viewed under the cut.
As it was before
Until the landmark 2010, the fifa had quite a decent keyboard control. The greatest advantage of the gamepad (at least, in my opinion) was the significantly greater availability of special
street techniques for working with the ball (the right analog stick was used for them). In the keyboard version, both sticks (both motion and feints) were tied to the usual arrows, and pressing the left shift allowed you to perform clever tricks. In fact, this is quite a tolerable decision, with which you can play: with some arrows I can control a running man and, when necessary, perform tricks while holding LShift.
How keyboardists were killed in Fifa 11
A very simple. In this version, the right stick was completely transferred to the numpad, and the movement was left on the arrows.
What's wrong with that? It is exceptional that now these are
different buttons. All the usual scheme based on sifta, flew to hell, and it was clear that to restore such a scheme is not possible. It worked, keyboardists became much less than in 10k.
It should be noted that I was going for a long time. I tolerated such management for a whole year, but just a couple of days ago, the cup of patience was completely overflowing.
The beginning of the fighting
Brewing tea stronger, I downloaded the WDK, opened an example of a keyboard filter, and decided to adjust it for my own needs. But the trouble was that it was my first (and almost unsuccessful) driver creation experience. In short, after about fifty reboots of the virtual machine (changing the keyboard driver required a reboot), I got a bit bored with picking up the code at six o'clock in the morning, and I fell asleep.
Morning, as you know, is always wiser than evening, and it brought a fresh thought. If FIFA loves a gamepad so much - why not? We'll emulate it ... I must say, many guys did this using the thing called KeyToJoy. She didn’t know what I wanted, but she was popular, because in the 11th Fife, for example, the keyboard wasn’t a full controller at all. I'll
warn you right away , a search for this keyword once led me to the archive where the virus was sitting. I warned.
In general, I decided that it would be nice to find some gamepad emulator, preferably with open code, and fix it so that the keyboard controls are as close as possible to my usual.
And found. Here it is:
VJoy homepage .
The author of this product is a great guy and just a good person, because he provided him with an excellent example of work, which was not difficult to remake in the necessary way.
')
Installing a virtual gamepad
Nothing complicated. Downloading the distribution kit (link to the site above), click “next” several times - and that's it.
No, really. And what is there to write about?
Device settings
After installation, you will need to configure the gamepad parameters (the number of buttons, axes ...), which will require the
vJoyConf utility . There, too, everything is very simple. For FIFA, 10 buttons (A, B, X, Y, start, back, LT, RT, LB, RB), four axes (x, y, z, rz), D-Pad with four directions are enough. The program does not reflect the current settings of the virtual gamepad, but only allows you to set new ones, so do not be afraid that the “settings have not been saved” - everything is preserved there.
Customized where to check?
Everything is very simple - we launch the applet “gaming devices” of the control panel (joy.cpl in “execute” is the fastest access option) and look at our virtual gamepad. What to do with him? Nothing yet, because nobody controls it yet.
We control the joystick
And for this we need, for example, MS Visual C ++ Express. Well, yes, now we will listen to the keyboard and tell our gamepad what buttons to consider to be pressed. And what, to me in fifu without tricks or something to play?
So,
here the creator of VJoy gives the world a simple C ++ console application that sends the gamepad commands to set a new state.
The example code is well documented, and in a couple of minutes it is remade as required by us in the context of a specific task (for the game in fifu). For example, this code provides a much-needed switch from left stick to right stick:
bool shift = 0!=GetAsyncKeyState(VK_LSHIFT); bool leftKey = 0!=GetAsyncKeyState(VK_LEFT); bool rightKey = 0!=GetAsyncKeyState(VK_RIGHT); bool upKey = 0!=GetAsyncKeyState(VK_UP); bool downKey = 0!=GetAsyncKeyState(VK_DOWN); Y = X = 0x3fff;
In fact, everything is very simple. We trace buttons, we transfer them to the gamepad.
What is the bonus? Obviously, the complexity of the logic of pressing buttons can be absolutely any,
and not just “one keyboard button = one gamepad button”, as it happens in simple ready-made emulators. You can customize as you like, and this may be of interest.
Conclusion
Who needs all this? I don’t know, I’m just writing about how I conceived something and successfully executed it. Suddenly someone such a decision would be useful?
A few words about the resulting emulator. The full source of raw, non-configurable, but the working product can be seen
here , in them, I think, there is nothing that should be written separately and in detail. Moreover, from the point of view of performance, this thing is not very effective, I am sure that it can be done much more intelligently if you sit longer with it. However, on that momentous evening, my hands were too much itchy to try out the creation, so as soon as the compiler spat out the exe file, all thoughts of modifications instantly disappeared somewhere.
It is also worth noting that in order to introduce the new joystick to the fifa, you need to slightly think about the buttonDataSetup.ini file in the user directory of the fifa. I'm not sure that these details (also settable independently in five to ten minutes) make sense to give here, but if anyone is interested in this question, then I will cover it.
UPD.
New version of the feeder . Now it emulates the analog stick smoother, which has a positive effect on the perception quality of the game of tricks. At the same time, the feeder is smart enough not to create a delay in response to abrupt changes in the direction of movement. You never know, suddenly someone takes advantage.