Editing inputBinding.xml

User avatar
Helazak
Posts: 358
Joined: Sun Jan 15, 2023 7:25 am
Location: US, East Coast

Editing inputBinding.xml

Post by Helazak »

I deleted my first post and copied it to post number 9 below. I wanted this first post to be a place for all the lessons learned. I didn't want people to have to read the entire thread to get the knowledge.

LESSONS LEARNED:
General:
  • Post #7 below has examples of 3 files, inputbinding.xml, a controller file for an ELECOM MMO Controller, and a log file.
  • When editing inputBindings.xml, if you do anything wrong the game replaces it with the default version. Always open the file in a browser first. It will check for obvious mistakes.
  • The inputBindings.xml file works hand in hand with the game controller file found in the folder
    ..../FarmingSimulator2022/inputDevices/
    If your controller/device is not supported by the input device xml's in that folder, you can edit an existing xml or create a new one for your controller/device. But do not place this new xml file in the /inputDevices folder as every update/verify action of the app will will wipe this folder and restore to a vanilla folder. Instead, place your new/own inputDevice xml in this folder:
    ..../FarmingSimulator2022/inputDevicesManual/ folder.
    This "Manual" folder is for customized device xml's and is not affected by app updates or verification actions
Controller.xml: I will discuss the controller file first because it defines the variable names associated with each key used in the inputBindings file. The game reaches into the inputDevicesManual folder and reads through any controller files contained therein, looking for the identification information to match the controller hardware connected to the computer. You can get the productId and vendorId values from the log file. It should detect your controller. You also need to set the category attribute to "gamepad".
  • The next section defines the buttonmapping which has 3 attributes.
<buttonMapping physical="0" logical="0" label="X"/>
  1. physical: relates to the hardware assignment of the key pressed. All the buttons are numbered starting at 0.
  2. logical: defines the button number that shows up in the inputBindings.xml file. The name is always one more than the logical number. Logical 0 = Button_1.
  3. label: is the name that will show up on the games Options/Gamepad Controls menu.
To determine the physical ID of your buttons, copy an existing controller file and replace the button entries with simple entries like this:
<buttonMappings>
<buttonMapping physical="0" logical="0" label="Label0"/>
<buttonMapping physical="1" logical="1" label="Label1"/>
<buttonMapping physical="2" logical="2" label="Label2"/>
etc.

Then you can go into the games options menu and assign each button to an action. I recommend gears 1-8 so you can do 8 buttons at once. Save and then open the inputBindings.xml and search for GEAR_Select where you can see which buttons have been assigned. Once you know the physical assignment of each key you can then assign logical numbers and labels as you see fit.
  • The next section defines axis definitions
<axisMapping physical="X" logical="0" scale="1" offset="0" label="LS-X"/>
  1. physical: relates to the hardware assignment of the Joystick axis. They do not follow a number system but use letters that represent the axis. I have not found a reference that explains them. Use other controller files as examples and experiment.
  2. logical: defines the variable name in the game. Logical 0 = AXIS_1, Logical 6 = AXIS_7
  3. Scale and offset: supposedly have to do with the values the hardware takes, but, I haven't experimented with them.
There are a number of gamepad testers online (just google them), but, they tend not to provide the names of the hardware variables of the axis. As mentioned earlier there is an example controller file below attached to post 7 and you can always look at the game provided files in /inputDevices/ folder.

inputBindings.xml: This file is directly edited using the options menu in the game. The primary reason to break into this file (IMHO) is if you want to use your controller to navigate around the menus in the game. Those assignments are not in the options menu.
  • The first section of the file is actionBinding where every action variable in the game is listed and the buttons that activate that action. The first action in the file is Jump so we will use that.
<actionBinding action="JUMP"> </actionBinding>

If this is what your file looks like, then you don't have any keys that can activate JUMP.
The game options menu has 5 columns for assigning keys. Two keyboard keys, a mouse key and two controller keys. (You might be able to assign more, but I had no reason to test that.)
Each key binding code looks like this: (and, you can have 5 of them inside each action)

<actionBinding action="JUMP">
<binding device="KB_MOUSE_DEFAULT" input="KEY_space" axisComponent="+" neutralInput="0" index="1"/>
<binding device="KB_MOUSE_DEFAULT" input="KEY_f12" axisComponent="+" neutralInput="0" index="2"/>
<binding device="KB_MOUSE_DEFAULT" input="MOUSE_BUTTON_LEFT" axisComponent="+" neutralInput="0" index="3"/>
<binding device="0_XINPUT_GAMEPAD" input="BUTTON_2" axisComponent="+" neutralInput="0" index="1"/>
<binding device="0_056E-200A" input="BUTTON_2" axisComponent="+" neutralInput="0" index="2"/>
</actionBinding>


I overpopulated this action so you can see how it works. <binding is the xml tag with the following attributes:
  1. device= the keyboard and the mouse are both part of the same device "KB_MOUSE_DEFAULT". Each game controller has its own identifier which you can discover by setting an action using the options menu and looking up its name here. This entry has two gamepads connected so there are two different devices. If you wanted two buttons to do the same action you would list the device name in both lines.
  2. input= specifies the name of the button. Keyboards and mice have predefined names and controller button names are defined based on the controler.xml file we just discussed.
  3. axisComponent= takes on the value of "+" or "-" and defines the direction the variable will take. Boolean variables (true false) only need a "+" which will toggle the value, but an integer variable (like which vehicle you are viewing) can be many values, so, you need to assign a button for "+" and a different button for "-", or you can assign an axis which does both up and down.
  4. neutralInput= is always equal to "0". I have an idea what it is for, but, since I never tested my theory, your guess is as good as mine.
  5. index= kind of represents which column in the options menu this key assignment will appear in. There are 3 columns on the keyboard tab and 2 on the gamepad tab. If you make two assignments on the same column the game will get confused.
This is an example of an axis assignment:
<actionBinding action="MENU_AXIS_UP_DOWN">
<binding device="KB_MOUSE_DEFAULT" input="KEY_up" axisComponent="+" neutralInput="0" index="1"/>
<binding device="KB_MOUSE_DEFAULT" input="KEY_down" axisComponent="-" neutralInput="0" index="1"/>
<binding device="0_XINPUT_GAMEPAD" input="AXIS_2-" axisComponent="+" neutralInput="0" index="1"/>
<binding device="0_XINPUT_GAMEPAD" input="AXIS_2+" axisComponent="-" neutralInput="0" index="1"/>
</actionBinding>


This is one of the hidden actions that sets how you navigate around menus. Notice the first two are both keyboard index 1, but, one is for the up or "+" direction and the other is for the down or "-" direction and each has a different keyboard key assigned.
The gamepad has used a joystick to command the menu "+" or "-". AXIS_2 happens in this case to be the left joystick up down motion. (Remember that name is assigned by the logical attribute in the controller file.) The + and- on the end of the AXIS_2 tells the game which direction you moved the joystick. The joystick and axiscomponent "+" and "-" do not have to match. For example, when moving a loader bucket; joystick down means bucket goes up. (Which is how my tractor works.) Because this action is not a Boolean it must have a "+" and a "-". An axis variable can have as many as 10 entries.
  • The next section is the devices section.
I have not had a need to mess with this section. I do know that a joystick has a deadzone in the center where no action will occur unless you move the stick beyond that point. Some joysticks over time get a little wiggle in them, and you may have to set a larger deadzone so you don't find yourself drifting to the side with no command. I can guess that the axis labels are the same as the rest of the file and are probably set by the controller.xml And sensitivity seems obvious, but I never tested this section.
<devices>
<device id="0_XINPUT_GAMEPAD" name="XINPUT_GAMEPAD" category="1">
<attributes axis="0" deadzone="0.140000" sensitivity="1.000000"/>
<attributes axis="1" deadzone="0.140000" sensitivity="1.000000"/>
<attributes axis="2" deadzone="0.140000" sensitivity="1.000000"/>
etc.


Feel free to post more information about these two files. I will try to keep this first post updated with more knowledge as it comes available.
Last edited by Helazak on Thu Mar 09, 2023 8:33 pm, edited 2 times in total.
FS22 on PC, FS14, FS16, FS20 on iPhone Not a gamer. Most gamer jargon goes over my head.
Started playing for the education about farming.

Amateur (noob) Farmer 5 mostly forested acres
Tractor: Kubota M4900 (54HP), w/ Loader bucket and forks
Attachments: log splitter, Chipper/shredder, finish mower, scrape blade, rock rake, double moldboard plow, rototiller, Garden Bedder
User avatar
W1der
Posts: 3795
Joined: Wed Jan 13, 2016 7:53 pm
Location: SWEDEN

Re: Editing inputBinding.xml

Post by W1der »

It´s been a while since I bothered with this but ... if I recall correctly ... the slightest error you do in the code ... the game will delete the file you created and replace it with the old default.

Which program are you using to make the changes?
I was recommended to use "notepad++" ... (I was told using "just any" editor might come with issues).

Not much help ... but I am glad you started this post and I will follow it ... as I need to do some cleaning up in this xml myself and it´s a bit different nowadays than it used to be when I was fiddling with it (years ago).
[Win11] Intel Core i9-13900F Tray 5.6GHz / MSI RTX4090 24GB GDDR6 / 2x16GB 5600MHz DDR5
User avatar
XiniX
Posts: 69
Joined: Wed Dec 04, 2019 7:11 am
Location: The Netherlands

Re: Editing inputBinding.xml

Post by XiniX »

If your controller/device is not supported by the input device xml's in the
..../FarmingSimulator2022/inputDevices folder.
You can edit an existing xml or create a new one for your controller/device.
But do not place this new xml file in the /inputDevices folder.
As every update/verify action of the app will will wipe this folder and restore to a vanilla folder.

To avoid the above, place your new/own inputDevice xml in this folder:
..../FarmingSimulator2022/inputDevicesManual folder.
This "Manual" folder is for customized device xml's and is not affected by app updates or verification actions
FS19: Macbook
FS22: Mac mini M1
FS14, FS16, FS18, FS20: iPad

Log.txt, how to post?
Images, how to post?
User avatar
Helazak
Posts: 358
Joined: Sun Jan 15, 2023 7:25 am
Location: US, East Coast

Re: Editing inputBinding.xml

Post by Helazak »

Thanks for posting guys. I felt alone for a while there.
Thanks for the heads up on the inputDevicesManual folder.

I have noticed that if you do anything wrong the game replaces the inputBindings.xml with the default version.
I have gotten in the habit of opening it in a browser, which checks for obvious problems.

I am using notepad to edit the actual file, but I am using Excel to deconstruct and reconstruct the entire file.

Have spent time mapping out the definitions of keyboard, mouse and gamepad controls, the FS22 name they use on the menu and the .xml tag name.
I have been able to reconstruct the format and can now make key assignments in my Excel file and then copy and past them into notepad to be saved as inputBindings.xml
Why would I want to do this instead of just using the in game settings menu? Because there are tags that are hidden from the game menu screen like which keys do you use to navigate around the menu. If the game let you edit that, then you could accidently edit your way to not being able to edit anything. My controller buttons could not navigate the menu system, so, I had to break into the inputBindings to make those assignments. And while I was at it I deconstructed the entire file.

It has been tedious work but I thrive on this type of stuff, so I haven't played the game in over a week. I want to get this new controller functional and deciding how to use all these buttons takes some thought.

Current problem:
The inputBindings.xml has two sections. One for binding the input keys to the game commands and a second that defines the device and sets a deadzone and sensitivity for each axis.
However, the game menu uses its own name for different commands and I dont know how it is finding those names. If you set a command to respond to pushing the left stick to the right on an xbox controller the menu shows (X)+ but in the .xml uses the AXIS_1+ tag.
The files in the inputDevices folder seem to be the source where the game knows to use (X)+
But it does not have a file for my device and when I use the menu to set a button on my controller it knows it is axis X+ (ELEMCO MMA GAMEPAD) so it is getting information somewhere.
The log file shows:
ELECOM MMO Gamepad (VID: 056E PID: 200A VER: 0018 Cat: UNKNOWN)
I still cant get the log file to see my device category anything besides UNKNOWN.
But the inputBinding.xml uses
<device id="0_056E-200A-0018-XFw/XEhJRCNWSURfMDU2RSZQSURfMjAwQSZNSV8wMSZDb2wwNCNiJjM4OWJmMjQyJjAmMDAwMyN7NGQxZTU1YjItZjE2Zi0xMWNmLTg4Y2ItMDAxMTExMDAwMDMwfQA=" name="056E - 200A" category="2">
I have been forcing the 2 in the device id category attribute only because 1 and 0 did nothing.

I hope the hint on using the inputDevicesManual folder may be the solution. I have some experimenting to do.

Nope didn't work. I tried the following settings
File name ELECOMController.xml
<deviceMapping backends="rawInput;directInput;macosXSdl">
<productKey productId="200A" vendorId="056E"/>
<productName vendorId="056E">
<keyword text="ELECOM"/>
<keyword text="MMO"/>
<keyword text="Gamepad"/>
</productName>
<category>gamepad</category>
I also tried
<keyword text="056E - 200A"/>
to see if matching the names would get recognized without luck.

I don't know if the game reads at all files in the inputDevicesManual folder or if I have to tell it to look there, or name the file something that it expects.
FS22 on PC, FS14, FS16, FS20 on iPhone Not a gamer. Most gamer jargon goes over my head.
Started playing for the education about farming.

Amateur (noob) Farmer 5 mostly forested acres
Tractor: Kubota M4900 (54HP), w/ Loader bucket and forks
Attachments: log splitter, Chipper/shredder, finish mower, scrape blade, rock rake, double moldboard plow, rototiller, Garden Bedder
User avatar
XiniX
Posts: 69
Joined: Wed Dec 04, 2019 7:11 am
Location: The Netherlands

Re: Editing inputBinding.xml

Post by XiniX »

I like this thread as it can become 🤞🏼🤞🏼 a knowledge base for inputdevices/inputbindings.
I'm aware I know not everything either, but I'm never to old to learn 😆

To avoid guessing on your current experimenting status it would be handy if
you attach your current inputBindings.xml, your custom input device xml and your log.txt.
FS19: Macbook
FS22: Mac mini M1
FS14, FS16, FS18, FS20: iPad

Log.txt, how to post?
Images, how to post?
User avatar
XiniX
Posts: 69
Joined: Wed Dec 04, 2019 7:11 am
Location: The Netherlands

Re: Editing inputBinding.xml

Post by XiniX »

Does your Elecom gamepad perhaps have a xinput/dinput mode switch?
If so, toggle it and check in log.txt if the device category "unknown" becomes "gamepad" after a new FS22 reboot.

FYI Xbox controllers do not support DirectInput at all, they only work with XInput. As FS22 works with xbox controllers, Xinput mode should work.

Edit: punctuation 😉
FS19: Macbook
FS22: Mac mini M1
FS14, FS16, FS18, FS20: iPad

Log.txt, how to post?
Images, how to post?
User avatar
Helazak
Posts: 358
Joined: Sun Jan 15, 2023 7:25 am
Location: US, East Coast

Re: Editing inputBinding.xml

Post by Helazak »

--I edited this entry to be current.--
I finally got my controller file to work. My Dpad was being recognized as another way to press buttons 17-20, so, I used the ELECOM driver software to assign the D-pad to the keyboard arrow keys. Now a Dpad press is not recognized as a game controller key but a keyboard key.

I was able to reverse engineer the definitions of the physical, logical and label fields and their relationship to the key definitions. (see next text entry)

All of my buttons now work and I have the axis labeled properly

Attachments have been updated to what currently works.
Attachments
ELECOMController2.xml
(4.49 KiB) Downloaded 53 times
log.txt
(6.7 KiB) Downloaded 49 times
inputBinding.xml
(144.2 KiB) Downloaded 81 times
Last edited by Helazak on Thu Mar 09, 2023 6:04 pm, edited 1 time in total.
FS22 on PC, FS14, FS16, FS20 on iPhone Not a gamer. Most gamer jargon goes over my head.
Started playing for the education about farming.

Amateur (noob) Farmer 5 mostly forested acres
Tractor: Kubota M4900 (54HP), w/ Loader bucket and forks
Attachments: log splitter, Chipper/shredder, finish mower, scrape blade, rock rake, double moldboard plow, rototiller, Garden Bedder
User avatar
Helazak
Posts: 358
Joined: Sun Jan 15, 2023 7:25 am
Location: US, East Coast

Re: Editing inputBinding.xml

Post by Helazak »

Been doing some testing and have made a discovery.
inputDevicesManual/ folder controller files. The <buttonmappings> assignments take the following form:
<buttonMapping physical="0" logical="1" label="X button" />
  • The physical attribute relates to the hardware assignment of the key pressed.
  • The logical attribute defines the button number that shows up in the inputBindings.xml file. The name is always one more than the logical number. Logical 0 = Button_1.
  • The Label attribute is the name that will show up on the games Options/Gamepad Controls menu.
FS22 on PC, FS14, FS16, FS20 on iPhone Not a gamer. Most gamer jargon goes over my head.
Started playing for the education about farming.

Amateur (noob) Farmer 5 mostly forested acres
Tractor: Kubota M4900 (54HP), w/ Loader bucket and forks
Attachments: log splitter, Chipper/shredder, finish mower, scrape blade, rock rake, double moldboard plow, rototiller, Garden Bedder
User avatar
Helazak
Posts: 358
Joined: Sun Jan 15, 2023 7:25 am
Location: US, East Coast

Re: Editing inputBinding.xml

Post by Helazak »

I copied my original post here because I wanted the first post to be a summary of the lessons we have learned.
Dont want people to have to read the entire thread to get the knowledge.
Helazak wrote: Wed Mar 01, 2023 3:41 am Why am I editing my inputBinding.xml file? Well it was recommended to me to solve a problem.
Quick Refresher of previous posts.

Burekcina wrote: Tue Feb 28, 2023 3:38 pm
Helazak wrote: Tue Feb 28, 2023 3:32 pm I got a new controller, which lets me custom map all my keys, but I am having trouble getting the keypad to navigate around the menu system. One menu option is to assign keys to game functions, but I can't find how to assign keys to navigate the menu.

If I assign my dpad to act like keypad arrows, then the computer always sees them as arrows, and I can no longer use them to assign game functions to.
I think you can setup the menu controls in the inputBinding.xml file, which can be found in Documents/MyGames/Farmingsimulator2022. I don't think there is another way..or being able to do it from the game itself. I had a throttle on a controller constantly scrolling in the menu page and had to delete the controls via the XML file, couldn't do it in the game settings.
Summary of other posts:
Helazak wrote: Tue Feb 28, 2023 5:06 pm My controller is not listed in the InputDevices folder; I expect I will have to create a file for it.
I started making a file ELECOMController.xml in the inputDevices folder by using examples of LogitechController.xml and XboxOneWiredController.xml but I am not sure how the game knows to look for the file in that directory?
I have been researching the inputBindings.xml code and have been able to identify the ID of my controller (which is about 60 characters long) by making changes to the settings and watching the file for changes.
I have identified what the code lines should look like in order to have my controller buttons work on the menu screens, but, when I make changes to the file, and then open the game, they get erased. I was under the impression that the inputBinding.xml file only got saved when you save controller settings, but, that appears to not be true. How do you make edits if the game keeps rewriting the file?
Getting a little frustrated. There is a wealth of knowledge on this forum, but I am only getting information in snatches based on lucky thread searches.

Outstanding questions:
  • Is there a tutorial on how inputbindings.xml works and its interaction with the files in the InputDevices folder?
  • Is there a general tutorial on setting up a controller? How does the game know how to populate default Xbox settings? Sometimes the title of the gamepad column lists the controller sometimes it is just Gamepad.
  • Is there a tutorial folder somewhere for XML files?
  • It would be nice to have the Rosetta Stone for log file too.
I started this post in the hopes that it will be easier for the next guy to find the information I can't seem to find. If there is a brain dump of information out there on this topic please point it out. If not then let this be the place.
FS22 on PC, FS14, FS16, FS20 on iPhone Not a gamer. Most gamer jargon goes over my head.
Started playing for the education about farming.

Amateur (noob) Farmer 5 mostly forested acres
Tractor: Kubota M4900 (54HP), w/ Loader bucket and forks
Attachments: log splitter, Chipper/shredder, finish mower, scrape blade, rock rake, double moldboard plow, rototiller, Garden Bedder
jtonofrey
Posts: 8
Joined: Mon Feb 05, 2024 1:10 pm

Re: Editing inputBinding.xml

Post by jtonofrey »

Helazak wrote: Thu Mar 09, 2023 6:11 pm I copied my original post here because I wanted the first post to be a summary of the lessons we have learned.
Dont want people to have to read the entire thread to get the knowledge.
Helazak wrote: Wed Mar 01, 2023 3:41 am Why am I editing my inputBinding.xml file? Well it was recommended to me to solve a problem.
Quick Refresher of previous posts.

Burekcina wrote: Tue Feb 28, 2023 3:38 pm

I think you can setup the menu controls in the inputBinding.xml file, which can be found in Documents/MyGames/Farmingsimulator2022. I don't think there is another way..or being able to do it from the game itself. I had a throttle on a controller constantly scrolling in the menu page and had to delete the controls via the XML file, couldn't do it in the game settings.
Summary of other posts:
Helazak wrote: Tue Feb 28, 2023 5:06 pm My controller is not listed in the InputDevices folder; I expect I will have to create a file for it.
I started making a file ELECOMController.xml in the inputDevices folder by using examples of LogitechController.xml and XboxOneWiredController.xml but I am not sure how the game knows to look for the file in that directory?
I have been researching the inputBindings.xml code and have been able to identify the ID of my controller (which is about 60 characters long) by making changes to the settings and watching the file for changes.
I have identified what the code lines should look like in order to have my controller buttons work on the menu screens, but, when I make changes to the file, and then open the game, they get erased. I was under the impression that the inputBinding.xml file only got saved when you save controller settings, but, that appears to not be true. How do you make edits if the game keeps rewriting the file?
Getting a little frustrated. There is a wealth of knowledge on this forum, but I am only getting information in snatches based on lucky thread searches.

Outstanding questions:
  • Is there a tutorial on how inputbindings.xml works and its interaction with the files in the InputDevices folder?
  • Is there a general tutorial on setting up a controller? How does the game know how to populate default Xbox settings? Sometimes the title of the gamepad column lists the controller sometimes it is just Gamepad.
  • Is there a tutorial folder somewhere for XML files?
  • It would be nice to have the Rosetta Stone for log file too.
I started this post in the hopes that it will be easier for the next guy to find the information I can't seem to find. If there is a brain dump of information out there on this topic please point it out. If not then let this be the place.
Real late to this, and appreciate all the work that's been put into this. I defiantly need a rosetta stone for this haha. But I have an xml file for my xbox elite 2 controller but it seems i am having problem with the game reading that file for inputs. Was wondering if we have made anymore headways on this?
User avatar
Helazak
Posts: 358
Joined: Sun Jan 15, 2023 7:25 am
Location: US, East Coast

Re: Editing inputBinding.xml

Post by Helazak »

Well I finally gave up on my ELECOM controller and sent it back. I could never find the key mapping for the D pad.
I was looking for more buttons and finally discovered the xBox chat pad that plugs into my Elite series 2.
So my xml editing came to a halt. Did learn alot though. Mostly how I wish there was more infomation available.
FS22 on PC, FS14, FS16, FS20 on iPhone Not a gamer. Most gamer jargon goes over my head.
Started playing for the education about farming.

Amateur (noob) Farmer 5 mostly forested acres
Tractor: Kubota M4900 (54HP), w/ Loader bucket and forks
Attachments: log splitter, Chipper/shredder, finish mower, scrape blade, rock rake, double moldboard plow, rototiller, Garden Bedder
Post Reply