Custom game config with tutorial - I need some help

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
ludogator
Posts: 2
Joined: Fri May 01, 2020 3:42 am

Custom game config with tutorial - I need some help

Post by ludogator » Mon May 04, 2020 5:25 am

Hi guys,

I've started playing around with custom configs so I can use my spacemouse with games. I've managed to get to know config files a little, but I still need some info. Below is my config with help section for Soldier of Fortune game:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--
(c) Copyright 3Dconnexion. All rights reserved. 
$Revision: 16358 $
-->

<AppCfg Default="true" xmlns="" CfgFormatVersion="1.3" ThisFileVersion="1.8">

<!--....................CONFIG FILE HEADER....................-->

	<CfgProperties>
		<ID>ID_Soldier of Fortune</ID>
		<Name>STR_Soldier of Fortune</Name>
		<InheritsFromID>ID_Base_Cfg</InheritsFromID>
	</CfgProperties>
 	<AuthorInfo>
		<DriverVersion>17.6.1</DriverVersion>
		<Created>
			<Tool>3DxService.exe</Tool>
			<Version>17.5.5</Version>
			<Date>2017:11:2:28:10:58:11:745</Date>
			<User>Ludogator</User>
		</Created>
		<LastChange>
			<Tool>XMLCfgEditor.exe</Tool>
			<Version>17.6.1</Version>
			<Date>6/27/2019 10:04:51 AM UTC</Date>
			<User>jwick</User>
		</LastChange>
	</AuthorInfo> 
	<AppInfo>
		<Signature>
			<Name>Soldier of Fortune</Name>
			<ExecutableName>SoF.EXE</ExecutableName>
			<Transport>KMJ</Transport>
		</Signature>
	</AppInfo>
	<Settings>
		<ResponseCurve>1.00</ResponseCurve>
		<!--<OverallScale>0.68</OverallScale>-->
	</Settings>

<!--....................DEVICE SETUP....................-->

	<Devices>
		<Device>
			<Name>Standard 3D Mouse</Name>
			<ID>ID_Standard_3D_Mouse</ID>
			<AxisFilter>None</AxisFilter>
			<CurrentAxisBank>Default</CurrentAxisBank>
			<CurrentButtonBank>Default</CurrentButtonBank>

			
<!--....................AXIS DEFINITION....................-->

<AxisBank Default="true">

	<Name>STR_DEFAULT_BANK</Name>
	<ID>Default</ID>



<!--crouch-->
     
	<Axis>
		<Enabled>True</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_z</ActionID>
			<Min>0</Min>
			<Max>511</Max>
			<Deadband>150</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>6</Key>
			</KeyStroke>
		</Output>
	</Axis>

<!--jump-->
 
	<Axis>
		<Enabled>True</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_z</ActionID>
			<Min>-512</Min>
			<Max>0</Max>
			<Deadband>20</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>2c</Key>
			</KeyStroke>
		</Output>
	</Axis>

<!--right-->

	<Axis>
		<Enabled>true</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_x</ActionID>
			<Min>0</Min>
			<Max>511</Max>
			<Deadband>50</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>7</Key>
			</KeyStroke>
		</Output>
	</Axis>

<!--left-->

	<Axis>
		<Enabled>true</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_x</ActionID>
			<Min>-512</Min>
			<Max>0</Max>
			<Deadband>50</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>4</Key>
			</KeyStroke>
		</Output>
	</Axis>

<!--back-->

	<Axis>
		<Enabled>true</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_y</ActionID>
			<Min>0</Min>
			<Max>511</Max>
			<Deadband>100</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>16</Key>
			</KeyStroke>
		</Output>
	</Axis>

<!--forward-->

	<Axis>
		<Enabled>true</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_y</ActionID>
			<Min>-512</Min>
			<Max>0</Max>
			<Deadband>100</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>1A</Key>
			</KeyStroke>
		</Output>
	</Axis>

<!--lean right-->

	<Axis>
		<Enabled>True</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_Ry</ActionID>
			<Min>-512</Min>
			<Max>0</Max>
			<Deadband>150</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>8</Key>
			</KeyStroke>
		</Output>
	</Axis>

<!--lean left-->

	<Axis>
		<Enabled>True</Enabled>
		<Input>
			<ActionID>HIDMultiAxis_Ry</ActionID>
			<Min>0</Min>
			<Max>511</Max>
			<Deadband>150</Deadband>
		</Input>
		<Output>
			<ActionID>KB_Keystroke</ActionID>
			<RepeatStyle>PressAndHold</RepeatStyle>
			<KeyStroke>
				<Key>14</Key>
			</KeyStroke>
		</Output>
	</Axis>

</AxisBank>

<!--....................BUTTON DEFINITION....................-->

<ButtonBank Default="true">
	<Name>STR_DEFAULT_BUTTONBANK</Name>
	<ID>Default</ID>

</ButtonBank>

		</Device>
	</Devices>
</AppCfg>


<!--....................HELP SECTION.....................

1. AXIS DEFINITION HELP

	................COMMAND......................			............................WHAT IT DOES.........................

	<Axis>									....Start....
		<Enabled>True</Enabled>					....Indication of activity....
		<Input>								....Input definition start....
			<ActionID>HIDMultiAxis_Ry</ActionID>	....INPUT....					See DICTIONARY for more info
			<Min>0</Min>						....Low axis range boarder....
			<Max>511</Max>					....High axis range boarder....		POSSIBLE RANGE: -512 TO 512. IT IS POSSIBLE TO DIVIDE RANGES TO GET MULTIPLE ASSIGNMENTS ON SINGLE AXIS
			
			<Deadband>150</Deadband>			....Deadzone....				POSSIBLE RANGE: 0 TO 511 (?)
		</Input>								....Input definition end....
		<Output>								....Output definition start....
			<ActionID>KB_Keystroke</ActionID>		....
			<RepeatStyle>PressAndHold</RepeatStyle>		....
			<KeyStroke>						....
				<Key>14</Key>					....
			</KeyStroke>						....
			<Modifiers>						....Modifiers section start....
				<Modifier>Control</Modifier>		....MODIFIER....			See DICTIONARY for more info
			</Modifiers>						....Modifiers section end....
		</Output>
	</Axis>

2. DICTIONARY

2.1 INPUTS

2.1.1 AXIS TRANSLATIONS (Put one of these in <ActionID></ActionID> brackets)

	HIDMultiAxis_x					....LEFT-RIGHT axis....
	HIDMultiAxis_y					....FRONT-BACK axis....
	HIDMultiAxis_z					....UP-DOWN axis....

2.1.2 AXIS ROTATIONS (Put one of these in <ActionID></ActionID> brackets)

	HIDMultiAxis_Rx					....rotation around LEFT-RIGHT axis....
	HIDMultiAxis_Ry					....rotation around FRONT-BACK axis....
	HIDMultiAxis_Rz					....rotation around UP-DOWN axis....

2.2 OUTPUTS

2.2.1 MODIFIERS

Modifiers are used as keys pressed while input is performed (for example mouse move with Shift pressed), two mods can be used for each output.

Possible modifiers are:

Control
Shift
Alt
Windows
LeftMouse
MiddleMouse
RightMouse

2.2.1.1 SAMPLE OUTPUT CODE WITH MODIFIER

        <Output>
		<ActionID>HIDMouse_X</ActionID>
		<Reversed>false</Reversed>
		<Modifiers>
			<Modifier>MiddleMouse</Modifier>1016271
		</Modifiers>
	</Output>

2.2.2 KEYBOARD

2.2.2.1 SAMPLE OUTPUT CODE

	<Output>
		<ActionID>KB_Keystroke</ActionID>
		<RepeatStyle>PressAndHold</RepeatStyle>
		<KeyStroke>
			<Key>14</Key>
		</KeyStroke>
	</Output>

2.2.2.2 KEY CODES

A-04	I-0C	Q-14	Y-1C	7-24	Enter-		28
B-05	J-0D	R-15	Z-1D	8-25	Escape-		29
C-06	K-0E	S-16	1-1E	9-26	Backspace-	2A
D-07	L-0F	T-17	2-1F	0-27	Tab-		2B
E-08	M-10	U-18	3-20		Space-		2C
F-09	N-11	V-19	4-21		-(minus)-	2D
G-0A	O-12	W-1A	5-22		=(equals)-	2E
H-0B	P-13	X-1B	6-23		

2.2.2.3 ADDITIONAL OPTIONS

<RepeatStyle>

2.2.3 MOUSE

2.2.3.1 SAMPLE OUTPUT CODE

	<Output>
		<ActionID>HIDMouse_X</ActionID>
		<Reversed>false</Reversed>
	</Output>

2.2.3.2 OUTPUT COMMANDS (Put one of these in <ActionID></ActionID> brackets)

	HIDMouse_X
	HIDMouse_Y
	HIDMouse_Wheel

2.2.4 JOYSTICK



....................THE END....................-->
I'd like to further develop this file to have a complex tutorial and maybe create a script to generate config files later (but I would need to remind and learn some scripting).

For now I need some help with:

- Header section:

1. Are there restrictions in what can and can't be written in ID and Name of CfgProperties section
2. What can be done in Settings section (and what are parameters names that can be used)

- I wanted to combine mouse movement with Spacebar pressed, but there is no modifier for that. Is there any workaround?

- Can I create a macro in GUI and then simply point it in config file to have it working with pointed axis?

Thanks for any help

jwick
Moderator
Moderator
Posts: 2680
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Custom game config with tutorial - I need some help

Post by jwick » Mon May 04, 2020 6:49 am

That's very nice.

I generally tell people that Base.xml is the dictionary and you are creating the book.

That is, Base.xml has all the words, that you pick from to create a specific cfg for your app/game.
If you want to override something, you can look in there for the default, and most importantly, the syntax. I try to put all the defaults in there so you aren't left guessing.
Between that, Global.xml, and a few of our default cfgs everything should have a sample. If we didn't use it, it probably wouldn't have been written.

Turning on the log file will help with diagnosing what is happening when nothing is happening. Baretail is a very nice way of seeing what is happening in real-time.
1. Are there restrictions in what can and can't be written in ID and Name of CfgProperties section
The strings are UTF-8, so pretty much anything is acceptable. The ID is used for other files to reference the file (e.g., user files in AppData). Name is only used for showing a name on the LCD/GUI.
2. What can be done in Settings section (and what are parameters names that can be used)
AppDefCfg_S80.xml shows usage of more elements.
- I wanted to combine mouse movement with Spacebar pressed, but there is no modifier for that. Is there any workaround?
No. Sorry. I don't recall getting that request before--but it is a good suggestion. The driver has an extension mechanism for handling non-builtin functionality. You have to write code for it.
- Can I create a macro in GUI and then simply point it in config file to have it working with pointed axis?
Yes, for the most part. I've tried to keep the syntax the same. You see there are some inconsistencies like the capitalization of KB_Keystroke vs <KeyStroke>. It can't do anything too complicated (built-in). E.g., Actions where one Axis has some modifiers pressed, yet another simultaneous Axis that doesn't have them pressed, is difficult to handle. We use the extension mechanism for complicated Actions.

ludogator
Posts: 2
Joined: Fri May 01, 2020 3:42 am

Re: Custom game config with tutorial - I need some help

Post by ludogator » Wed May 06, 2020 11:05 am

Thanks for answers, they are really helpful.

Two more things are making me problems at the moment:

1. Is the HID device the only possible joystick output? I'd like to get xinput outputs - is it possible or I need to look for some third party tool?

2. Some of my configs seem to currupt the GUI. I'm placing them in Cfg folder, then I start the game I want to test setting for. When I have the corrupted XML in Cfg folder, GUI becomes too sensitive for app activity. In result it resets to Explorer.exe instantly after I press Alt+TAB and I'm unable to tune axis sensitivity or assign buttons. The fun fact is, I have two almost the same configs (they differ only in executable name and ID's), and one is fully working and the other one causes this problem.
Restart of driver or system couldn't fix that. Are there any known issues that can cause similar behaviour?

jwick
Moderator
Moderator
Posts: 2680
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Custom game config with tutorial - I need some help

Post by jwick » Thu May 07, 2020 12:54 am

1. Is the HID device the only possible joystick output? I'd like to get xinput outputs - is it possible or I need to look for some third party tool?
The only built in devices are the KMJ devices. We are thinking about adding others like XInput. The driver has an extension mechanism that we use, and you can also use, to extend the output possibilities. I'd like to see MIDI added.
2. Some of my configs seem to currupt the GUI. I'm placing them in Cfg folder, then I start the game I want to test setting for. When I have the corrupted XML in Cfg folder, GUI becomes too sensitive for app activity. In result it resets to Explorer.exe instantly after I press Alt+TAB and I'm unable to tune axis sensitivity or assign buttons. The fun fact is, I have two almost the same configs (they differ only in executable name and ID's), and one is fully working and the other one causes this problem.
Restart of driver or system couldn't fix that. Are there any known issues that can cause similar behaviour?
Nothing comes to mind.

Are you putting your cfgs in %APPDATA% or %PROGRAMDATA%? APPDATA is for user changes. PROGRAMDATA is for new default files. Any files in PD will override the files we ship in ProgramFiles.

The driver will log a lot of information about what it is doing, and problems it finds, if you turn on logging on with a right click on our systray icon. The log file is in %LOCALAPPDATA%\3dconnexion\3DxWare\3DxService.log. Recent drivers do more to detect problems in cfg files. They will reject a cfg and move it to a bak dir.

Post Reply