v18 Problems with games
#1
Shocked 
I am using Kodi as a launchbox(advanced emulator launcher) and media player, but I have a problem. If I play the game without Kodi in the background, it runs fine. If I play it with Kodi in the background after a while the screen black for a second and the game looses focus, sometimes it returns to the game sometimes to Kodi. I can't exactly identify what the problem is seems like Kodi is trying to get into focus? Or is it just getting my inputs from games?
Reply
#2
(2020-03-12, 18:02)misterright1 Wrote: I am using Kodi as a launchbox(advanced emulator launcher) and media player, but I have a problem. If I play the game without Kodi in the background, it runs fine. If I play it with Kodi in the background after a while the screen black for a second and the game looses focus, sometimes it returns to the game sometimes to Kodi. I can't exactly identify what the problem is seems like Kodi is trying to get into focus? Or is it just getting my inputs from games?

Some linux users have noted that as an issue, where Kodi is still accepting input in the background (issue documented here) The workaround (currently) is to launch your game with a shell script that either pauses Kodi or exits Kodi and then restarts it after you exit the game. AEL may already have some scripts to do just this, suggest asking in that help thread.

Also if possible it would be great to get a debug log of your issue, since up to this point I think we haven't gotten one.
Reply
#3
@misterright1 Can you provide more info about your setup, like operating system, etc.? Also, it is better to write problems of an specific addon in the addon thread, otherwise addon authors can miss it.

The problem you mention is a well-known issue. If you use Linux, the most common cause is that you do not use a window manager with Kodi. In Windows, the main cause is to use Kodi without the windows shell.
Reply
#4
What should be the solution when Kodi can't talk to the window manager? Expose an API to notify the app of foreground/background events?
Reply
#5
(2020-03-20, 06:47)garbear Wrote: What should be the solution when Kodi can't talk to the window manager? Expose an API to notify the app of foreground/background events?

There are two solutions:

a) Use a window manager like Openbox. Problem here is that the most used Linux distro for Kodi which is LibreELEC does not include one, TTBOMK. @Milhouse Is it possible to add the option to use Openbox in an easy way in LibreELEC?

b) If there is no window manager and Kodi is working in standalone mode then it should do as a mini window manager. If an application is spawned from Kodi, the new app window must be placed on top and maximized. When the app is closed Kodi gets the focus. I'm not sure about the complexity of this approach, in terms of the changes required in Kodi.

The option to disable joystick input in Kodi is kind of a workaround. If there is no window manager and you launch an app there are race conditions for getting the focus, getting the input devices events (keyboard, mouse, gamepad), window placement, etc. Disabling the joystick in Kodi from addons will help but it is not the proper solution in my opinion.
Reply
#6
(2020-03-20, 08:59)Wintermute0110 Wrote: Is it possible to add the option to use Openbox in an easy way in LibreELEC?
This is a non-starter, really. ARM-based versions of LibreELEC don't have a widow manager, while x86_64 LibreELEC uses Fluxbox which is similar to Openbox. Replacing Fluxbox with Openbox isn't therefore guaranteed to fix this issue (assuming this issue has been reported against x86_64 LibreELEC, as it's not clear what distro is involved). And trying to add an x11 window manager on ARM to solve this one issue... would be overkill (assuming it were even possible!)

The easiest solution (without changing Kodi or LibreELEC) would be for the game add-on to shutdown Kodi (systemctl stop kodi) as the add-on starts, and for the game add-on to restart Kodi (systemctl start kodi) just as the game add-on exits. Some add-ons already take this approach, which works with all Kodi and LibreELEC versions.

A more elegant solution involving API changes and/or window focus (z buffer?) changes would likely require extending core Kodi functionality, limiting support to Kodi 19 (or possibly later), so not likely to be a quick fix.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#7
(2020-03-20, 09:46)Milhouse Wrote: This is a non-starter, really. ARM-based versions of LibreELEC don't have a widow manager, while x86_64 LibreELEC uses Fluxbox which is similar to Openbox. Replacing Fluxbox with Openbox isn't therefore guaranteed to fix this issue (assuming this issue has been reported against x86_64 LibreELEC, as it's not clear what distro is involved). And trying to add an x11 window manager on ARM to solve this one issue... would be overkill (assuming it were even possible!)

Fluxbox should do the job, I mentioned Openbox just because it is the WM I regularly use. Thanks for clarifying x86_64 LibreELEC uses Fluxbox, I was not aware of that. Out of curiosity, why ARM does not have a WM?

(2020-03-20, 09:46)Milhouse Wrote: The easiest solution (without changing Kodi or LibreELEC) would be for the game add-on to shutdown Kodi (systemctl stop kodi) as the add-on starts, and for the game add-on to restart Kodi (systemctl start kodi) just as the game add-on exits. Some add-ons already take this approach, which works with all Kodi and LibreELEC versions.

Users can already do that with a wrapper script in AEL. However, the nice thing about keeping Kodi in the background is that when you close the emulator Kodi is the same way you left it, with the item you launched focused, which enriches the user experience. This is important when you are browsing you games and testing them. Players that launch a game for a several-hour session don't mind closing Kodi though.

(2020-03-20, 09:46)Milhouse Wrote: A more elegant solution involving API changes and/or window focus (z buffer?) changes would likely require extending core Kodi functionality, limiting support to Kodi 19 (or possibly later), so not likely to be a quick fix.

Yes, I'm not sure if the changes required in the core will be difficult or not, or will take a lot of time or not, I've never used the X API directly. However, it can be considered as a nice-to-have long-term feature when Kodi is working in standalone mode.
Reply
#8
@misterright1 Can you please report the platform, OS version and Kodi version you are using? Or even better, a debug log following the instructions in the first post in AEL thread? The debug log has all the information we need.
Reply
#9
(2020-03-20, 09:46)Milhouse Wrote: The easiest solution (without changing Kodi or LibreELEC) would be for the game add-on to shutdown Kodi (systemctl stop kodi) as the add-on starts, and for the game add-on to restart Kodi (systemctl start kodi) just as the game add-on exits. Some add-ons already take this approach, which works with all Kodi and LibreELEC versions.

Yes, this is currently the only solution. It works fine enough, but as @Wintermute0110 said, it's not perfect. In the past I had attempted in vain to disable input on the addon side with the setting input.enablejoystick, but that currently crashes Kodi when toggled (old issue was closed after trac was no longer used for PRs, I could open a new git issue if there's potential to get that working). That would potentially be the other solution.
Reply
#10
(2020-03-20, 13:35)Wintermute0110 Wrote: Out of curiosity, why ARM does not have a WM?
Not entirely sure, @lrusak probably knows most about this, but I don't think the ARM-based video drivers have ever had a hard dependency on x11 as is the case with x86_64 (Nvidia GPU drivers etc.)

Given the "embedded" history of ARM, many SOCs are happy to run Linux with just a frame buffer. I'm sure it would be possible to get an X11 server running on ARM (Raspbian already does it) but there's absolutely no requirement for it to run Kodi so for LibreELEC it would be a waste of resources. Plus, the days of X11 are numbered (with Wayland as a potential replacement, one day, maybe...).
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#11
I've opened a PR to address this: https://github.com/xbmc/xbmc/pull/17529 . It exposes an API in the form of a setting that can be toggled to enable/disable controller support based on external knowledge (such as when a client decides that Kodi is no longer in the foreground).
Reply
#12
(2020-03-20, 19:16)Milhouse Wrote:
(2020-03-20, 13:35)Wintermute0110 Wrote: Out of curiosity, why ARM does not have a WM?
Not entirely sure, @lrusak probably knows most about this, but I don't think the ARM-based video drivers have ever had a hard dependency on x11 as is the case with x86_64 (Nvidia GPU drivers etc.)

Given the "embedded" history of ARM, many SOCs are happy to run Linux with just a frame buffer. I'm sure it would be possible to get an X11 server running on ARM (Raspbian already does it) but there's absolutely no requirement for it to run Kodi so for LibreELEC it would be a waste of resources. Plus, the days of X11 are numbered (with Wayland as a potential replacement, one day, maybe...).  
Using a windowmanager for SOC's that want to write directly to the framebuffer (RPi, anything running GBM windowing) will have their hw video acceleration broken. Of course you could always render into GLES/EGL but most SOC's have very week GPU's and it's a waste of resources.

So no, I wouldn't advise adding a window manager to LibreELEC for ARM SOC's. When everything changes over to GBM LibreELEC will really be a Kodi only distro (there is always work arounds but meh). Running external apps on LibreELEC has always been a hack anyways (with or without a windowmanager).
"PPC is too slow, your CPU has no balls to handle HD content." ~ Davilla
"Maybe it's a toaster. Who knows, but it has nothing to do with us." ~ Ned Scott
Reply
#13
I seemed to have been logged out of Kodi forums for a while, I have no idea why. nor did I receive a mail regarding anybody replying to me. I resolved the issue by reinstalling windows in it's entirety.
Reply

Logout Mark Read Team Forum Stats Members Help
Problems with games0