Kodi Community Forum

Full Version: GSOC20 query: Controller configuration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I noticed that in the DosBOX Addon for Kodi, only the default controller configuration has been added and thus can't configure other controllers. Is it viable to work on controller configuration addition and integration with the game engine
Yes, this is a valid project idea. I added something similar, though a bit more generic, to the wiki list: https://kodi.wiki/view/Google_Summer_of_...etroPlayer
(2020-02-22, 09:38)garbear Wrote: [ -> ]Yes, this is a valid project idea. I added something similar, though a bit more generic, to the wiki list: https://kodi.wiki/view/Google_Summer_of_...etroPlayer

Thank you very much for the feedback,
I will work on the idea and break it into a workable project, and keep seeking further guidance on the forum.
@garbear  i checked that you had added the controller mapping, but on my system there still is only one controller with mapping enabled, that is the default kodi controller. Is this a bug or has it been truly not implemented?
@cool-pants See the guide I wrote: https://kodi.wiki/view/HOW-TO:Map_multiple_controllers

Maybe it's still not clear, let me know and when we figure it out I'll improve the guide
(2020-02-28, 04:39)garbear Wrote: [ -> ]@cool-pants See the guide I wrote: https://kodi.wiki/view/HOW-TO:Map_multiple_controllers

Maybe it's still not clear, let me know and when we figure it out I'll improve the guide
Hello,
I checked the kodi wiki and the application. There is a mapping option for all controllers if i go from the homepage but only the default controller from game or DOSbox interface.
ImageImage
Image
OK, I see what you're saying now. The difference in behaviors is because a playing game acts as a "filter" - only controllers supported by that game are shown. See: https://github.com/xbmc/xbmc/blob/master...w.cpp#L210 . It looks for an active game client (libretro core), and passes that to the controller list if discovered.

So assume the controller window knows which core is active, how does it know which controllers to show? That is determined by a file named topology.xml which you can see here: https://github.com/kodi-game/game.libret...pology.xml

topology.xml defines the "controller topology", which is a tree with the console as the root, and the supported controllers as nodes. For more information, see the controller topology project: https://github.com/kodi-game/controller-...gy-project

The image that says "nothing to map" is concerning. Why is that list empty? That might be a good first bug to track down.
(2020-02-28, 22:40)garbear Wrote: [ -> ]OK, I see what you're saying now. The difference in behaviors is because a playing game acts as a "filter" - only controllers supported by that game are shown. See: https://github.com/xbmc/xbmc/blob/master...w.cpp#L210 . It looks for an active game client (libretro core), and passes that to the controller list if discovered.

So assume the controller window knows which core is active, how does it know which controllers to show? That is determined by a file named topology.xml which you can see here: https://github.com/kodi-game/game.libret...pology.xml

topology.xml defines the "controller topology", which is a tree with the console as the root, and the supported controllers as nodes. For more information, see the controller topology project: https://github.com/kodi-game/controller-...gy-project

The image that says "nothing to map" is concerning. Why is that list empty? That might be a good first bug to track down.
So according to the topology code only the controllers attached to the active core should be shown and the rest should not be shown at all right?

And also could you please guide me on the process of compilation of the code to test if the changes work or not.
(2020-02-29, 16:11)cool-pants Wrote: [ -> ]So according to the topology code only the controllers attached to the active core should be shown and the rest should not be shown at all right?

Yes. Does your second picture show that is not the case? If you post a debug log, I might be able to see what's wrong.

(2020-02-29, 16:11)cool-pants Wrote: [ -> ]And also could you please guide me on the process of compilation of the code to test if the changes work or not. 

We have compilation docs for many platforms here: https://github.com/xbmc/xbmc/tree/master/docs
 
If you get stuck, struggle a little, then come back and I'll point you in the right direction Smile
(2020-02-29, 22:09)garbear Wrote: [ -> ]Yes. Does your second picture show that is not the case? If you post a debug log, I might be able to see what's wrong.
I figured out what was wrong. Apparently this bug only occurs when we run a game that is not compatible with the emulator engines, for the above case DOOM, which I downloaded separately.
But shouldn't we display a not compatible message for such games rather than let them run.

PS: it is working fine on games I downloaded through Kodi addons
(2020-03-02, 09:21)cool-pants Wrote: [ -> ]I figured out what was wrong. Apparently this bug only occurs when we run a game that is not compatible with the emulator engines, for the above case DOOM, which I downloaded separately.
But shouldn't we display a not compatible message for such games rather than let them run.

Sounds like this would make for a good, simple PR Smile
(2020-03-05, 03:20)garbear Wrote: [ -> ]Sounds like this would make for a good, simple PR Smile
On it thanks.
Excuse me @garbear  i checked the debug log to figure out where the game is actually getting stuck at, i.e. is it during creating an instance of the game client or while actually trying to run the game. 

2020-03-09 14:14:53.301 T:13028   DEBUG: CGUIMediaWindow::GetDirectory (D:\Games\Age of Empires 3 - Complete Edition\)
2020-03-09 14:14:53.301 T:13028   DEBUG:   ParentPath = []
2020-03-09 14:14:53.302 T:15696   DEBUG: Thread waiting start, auto delete: false
2020-03-09 14:14:53.303 T:15696   DEBUG: Thread waiting 15696 terminating
2020-03-09 14:14:55.494 T:13028   DEBUG: CInputManager:TonguerocessMouse: trying mouse action leftclick
2020-03-09 14:14:55.495 T:13028   DEBUG: CGUIMediaWindow::GetDirectory (D:\Games\Age of Empires 3 - Complete Edition\bin\)
2020-03-09 14:14:55.495 T:13028   DEBUG:   ParentPath = [D:\Games\Age of Empires 3 - Complete Edition\]
2020-03-09 14:14:55.496 T:1112   DEBUG: Thread waiting start, auto delete: false
2020-03-09 14:14:55.596 T:13028   DEBUG: ------ Window Init (DialogBusy.xml) ------
2020-03-09 14:14:56.799 T:1112   DEBUG: Thread waiting 1112 terminating
2020-03-09 14:14:56.799 T:13028   DEBUG: ------ Window Deinit (DialogBusy.xml) ------
2020-03-09 14:14:56.800 T:13028   DEBUG: Saving fileitems [D:\Games\Age of Empires 3 - Complete Edition\bin\]
2020-03-09 14:14:56.803 T:13028   DEBUG:   -- items: 69, sort method: 0, ascending: false
2020-03-09 14:14:57.465 T:13028   DEBUG: CInputManager:TonguerocessMouse: trying mouse action wheeldown
2020-03-09 14:14:58.515 T:13028   DEBUG: Previous line repeats 10 times.
2020-03-09 14:14:58.515 T:13028   DEBUG: Keyboard: scancode: 0x01, sym: 0x001b, unicode: 0x001b, modifier: 0x0
2020-03-09 14:14:58.682 T:13028   DEBUG: Keyboard: scancode: 0x01, sym: 0x001b, unicode: 0x0000, modifier: 0x0
2020-03-09 14:14:58.682 T:13028   DEBUG: CInputManager::HandleKey: escape (0xf01b) pressed, action is PreviousMenu
2020-03-09 14:14:58.682 T:13028   DEBUG: CGUIWindowManager:TonguereviousWindow: Deactivate

Also i am simultaneously looking into mapping of multiple controllers onto the game, so i had a doubt, do we allow multiple controller mapping and use during the game client is running or do we want the multiple controllers for the kodi interface as well. Personally i think the former makes more sense, but please advise.
(2020-03-09, 11:32)cool-pants Wrote: [ -> ]Excuse me @garbear  i checked the debug log to figure out where the game is actually getting stuck at, i.e. is it during creating an instance of the game client or while actually trying to run the game. 

2020-03-09 14:14:53.301 T:13028   DEBUG: CGUIMediaWindow::GetDirectory (D:\Games\Age of Empires 3 - Complete Edition\)
2020-03-09 14:14:53.301 T:13028   DEBUG:   ParentPath = []
2020-03-09 14:14:53.302 T:15696   DEBUG: Thread waiting start, auto delete: false
2020-03-09 14:14:53.303 T:15696   DEBUG: Thread waiting 15696 terminating
2020-03-09 14:14:55.494 T:13028   DEBUG: CInputManager:TonguerocessMouse: trying mouse action leftclick
2020-03-09 14:14:55.495 T:13028   DEBUG: CGUIMediaWindow::GetDirectory (D:\Games\Age of Empires 3 - Complete Edition\bin\)
2020-03-09 14:14:55.495 T:13028   DEBUG:   ParentPath = [D:\Games\Age of Empires 3 - Complete Edition\]
2020-03-09 14:14:55.496 T:1112   DEBUG: Thread waiting start, auto delete: false
2020-03-09 14:14:55.596 T:13028   DEBUG: ------ Window Init (DialogBusy.xml) ------
2020-03-09 14:14:56.799 T:1112   DEBUG: Thread waiting 1112 terminating
2020-03-09 14:14:56.799 T:13028   DEBUG: ------ Window Deinit (DialogBusy.xml) ------
2020-03-09 14:14:56.800 T:13028   DEBUG: Saving fileitems [D:\Games\Age of Empires 3 - Complete Edition\bin\]
2020-03-09 14:14:56.803 T:13028   DEBUG:   -- items: 69, sort method: 0, ascending: false
2020-03-09 14:14:57.465 T:13028   DEBUG: CInputManager:TonguerocessMouse: trying mouse action wheeldown
2020-03-09 14:14:58.515 T:13028   DEBUG: Previous line repeats 10 times.
2020-03-09 14:14:58.515 T:13028   DEBUG: Keyboard: scancode: 0x01, sym: 0x001b, unicode: 0x001b, modifier: 0x0
2020-03-09 14:14:58.682 T:13028   DEBUG: Keyboard: scancode: 0x01, sym: 0x001b, unicode: 0x0000, modifier: 0x0
2020-03-09 14:14:58.682 T:13028   DEBUG: CInputManager::HandleKey: escape (0xf01b) pressed, action is PreviousMenu
2020-03-09 14:14:58.682 T:13028   DEBUG: CGUIWindowManager:TonguereviousWindow: Deactivate

I don't see a game being played, just the GUI navigated? Can you post a full debug log to our pastie site?
(2020-03-09, 11:32)cool-pants Wrote: [ -> ]Also i am simultaneously looking into mapping of multiple controllers onto the game, so i had a doubt, do we allow multiple controller mapping and use during the game client is running or do we want the multiple controllers for the kodi interface as well. Personally i think the former makes more sense, but please advise.

Multiple controllers are supported, as defined by topology.xml. You can map any controller in the GUI, it will start mapping a controller when its first button is mapped, then proceed to only map that controller and ignore the other until mapping is finished.

I encourage you to find the above logic in the codebase. Start by finding the file IConfigurationWindow.h. I wanted the controller window to have its architecture well documented. Few windows in Kodi have this luxury Smile
If you're bored, you can read about some of the theory behind the current configuration system: https://forum.kodi.tv/showthread.php?tid...pid2933762