HOW-TO:Modify joystick.xml: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(Initial page)
 
mNo edit summary
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{mininav| [[Remote controls]] {{l2| [[Games]] }} | [[Game controllers]]}}
{{mininav| [[Remote controls]] {{l2| [[Games]] }} | [[Game controllers]]}}
{{future|17}}


<section begin="intro" />Actions in Kodi are defined by [[Keymap|Keymaps]]. If you would like to change the actions for a [[Game controllers|game controller]], you will need to edit your joystick.xml file.<section end="intro" />
<section begin="intro" />Actions in Kodi are defined by [[Keymap|Keymaps]]. If you would like to change the actions for a [[Game controllers|game controller]], you will need to edit your joystick.xml file.<section end="intro" />
Line 7: Line 5:


'''Note:''' [[Add-on:Keymap Editor]] does not work for controllers at this time.
'''Note:''' [[Add-on:Keymap Editor]] does not work for controllers at this time.


== General configuration ==
== General configuration ==


Controllers are configured in two separate locations. First, you must map your controller in the controller configuration utility. See [[HOW-TO:Configure controllers]]. This defines the physical layout of your controller.
Controllers are configured in two separate locations:
 
* First, you must map your controller in the configuration utility (see [[HOW-TO:Configure controllers]])
* Optionally, Kodi uses a [[Keymap]] named <tt>joystick.xml</tt> to define Kodi actions for each button
 


This guide describes how to modify the Keymap.


Once the physical layout of the controller is set, Kodi uses a [[Keymap]] to define which Kodi actions each button does (joystick.xml). This guide describes how to modify the Keymap.


'''Note:''' <tt>joystick.xml</tt> defines actions for an Xbox 360 controller. See [[HOW-TO:Map multiple controllers]].


'''Note:''' joystick.xml defines actions for an Xbox 360 controller. If you mapped a different controller profile, then joystick.xml will translate this to an Xbox 360 controller.


== Location of joystick.xml ==
== Location of joystick.xml ==


The file joystick.xml should be located with Kodi's other keymaps (see [[Keymap#Location of keymaps|Location of keymaps]]). They keymap placed in the [[userdata]] folder will override the keymap shipped with Kodi.
The file joystick.xml should be located with Kodi's other keymaps (see [[Keymap#Location of keymaps|Location of keymaps]]). They keymap placed in the [[userdata]] folder will override the keymap shipped with Kodi.


== Structure ==
== Structure ==


The structure is similar to Kodi's other keymaps:
The structure is similar to Kodi's other [[keymaps]]:


<syntaxhighlight lang="xml" enclose="div">
<syntaxhighlight lang="xml" enclose="div">
<keymap>
<keymap>
   <global>
   <global>
     <joystick>
     <joystick profile="game.controller.default">
       <a>Select</a>
       <a>Select</a>
       <b>Back</b>
       <b>Back</b>
Line 66: Line 70:
</keymap>
</keymap>
</syntaxhighlight>
</syntaxhighlight>


== Planned features ==
== Planned features ==
Line 79: Line 84:
       [...]
       [...]
</syntaxhighlight>
</syntaxhighlight>
== See also ==
* {{big|'''[[HOW-TO:Configure controllers]]'''}}
* {{big|'''[[HOW-TO:Share button maps]]'''}}
[[Category:Gaming]]
[[Category:Manual]]
[[Category:Remotes]]

Latest revision as of 00:32, 15 December 2020

Home icon grey.png   ▶ Remote controls
▶ Games
▶ Game controllers ▶ HOW-TO:Modify joystick.xml

Actions in Kodi are defined by Keymaps. If you would like to change the actions for a game controller, you will need to edit your joystick.xml file.


Note: Add-on:Keymap Editor does not work for controllers at this time.


General configuration

Controllers are configured in two separate locations:

  • First, you must map your controller in the configuration utility (see HOW-TO:Configure controllers)
  • Optionally, Kodi uses a Keymap named joystick.xml to define Kodi actions for each button


This guide describes how to modify the Keymap.


Note: joystick.xml defines actions for an Xbox 360 controller. See HOW-TO:Map multiple controllers.


Location of joystick.xml

The file joystick.xml should be located with Kodi's other keymaps (see Location of keymaps). They keymap placed in the userdata folder will override the keymap shipped with Kodi.


Structure

The structure is similar to Kodi's other keymaps:

<keymap>
  <global>
    <joystick profile="game.controller.default">
      <a>Select</a>
      <b>Back</b>
      <x>ContextMenu</x>
      <y>FullScreen</y>
      <start>ActivateWindow(PlayerControls)</start>
      <back>PreviousMenu</back>
      <guide>ActivateWindow(Home)</guide>
      <up>Up</up>
      <down>Down</down>
      <right>Right</right>
      <left>Left</left>
      <leftthumb>Screenshot</leftthumb>
      <rightthumb>ActivateWindow(ShutdownMenu)</rightthumb>
      <lefttrigger>ScrollUp</lefttrigger>
      <righttrigger>ScrollDown</righttrigger>
      <leftbumper>ScrollUp</leftbumper>
      <rightbumper>ScrollDown</rightbumper>
      <leftstickleft>Left</leftstickleft>
      <leftstickright>Right</leftstickright>
      <leftstickup>Up</leftstickup>
      <leftstickdown>Down</leftstickdown>
      <rightstickleft>VolumeDown</rightstickleft>
      <rightstickright>VolumeUp</rightstickright>
      <rightstickup>VolumeUp</rightstickup>
      <rightstickdown>VolumeDown</rightstickdown>
    </joystick>
  </global>

  <Home>
    [...]
  </Home>

  [...]

</keymap>


Planned features

In the future, it will be possible to define actions for holding buttons, similar to Long presses:

<keymap>
  <global>
    <joystick>
      <a>Select</a>
      <a holdtime="250">ContextMenu</a>
      [...]


See also