kodi-game / game.libretro

Libretro compatibility layer for the Kodi Game API
GNU General Public License v2.0
37 stars 26 forks source link

Generated addon settings in the wrong directory #78

Closed zach-morris closed 2 years ago

zach-morris commented 2 years ago

Tested recently on Kodi 19.1. Steps to see issue: 1) Install an addon from the standard Kodi repository. In my example I installed game.libretro.mame2003_plus 2) When the addon is installed, I note that the addon screen shows that the addon cannot be configured 3) Start a game, go to settings>Advance Settings and see the same thing "This addon cannot be configured" However I expect I should be able to configure this addon.

I see that there is a settings file and language files generated in: ...path to userdata/addon_data/game.libretro.mame2003_plus/generated/

If I move those files to: ...path to addons/game.libretro.mame2003_plus/resources/

And restart Kodi, then I can configure the addon. It appears that the generated files are not being placed in the correct directory.

I think this is the right repository for this issue as just looking at the source code, it includes the SettingsGenerator functions, but if this isn't the right place please let me know.

garbear commented 2 years ago

This is by design. Generated files are placed in a folder named "generated", then it's expected that they are manually installed by the user. The reason is because the addons/ directory may not be writable on all systems.

If the add-ons are installed by the add-on manager, then they'll appear in a writable folder, and we're able to write files to that folder. However, add-ons installed alongside Kodi are in a read-only directory on most platforms. Consider that on Linux, add-ons can be installed from the debian repository via apt, and these are placed in a read-only directory. This is the case for add-ons installed with Kodi.

garbear commented 2 years ago

A better folder to place generated files would be

userdata/addon_data/game.libretro/generated/game.libretro.mame2003_plus

Files are generated by game.libretro, so they should end up in its profile folder. I would also group generated files together, and then sub-divide by the core the generated files are for.

I can prepare this change in a PR if you agree.

zach-morris commented 2 years ago

A better folder to place generated files would be

userdata/addon_data/game.libretro/generated/game.libretro.mame2003_plus

Files are generated by game.libretro, so they should end up in its profile folder. I would also group generated files together, and then sub-divide by the core the generated files are for.

I can prepare this change in a PR if you agree.

I think this is a hurdle most users will just miss and assume it's not working or incomplete. Bottom line, the user isn't able to configure the addon without manual intervention (is that correct)? Seems like the packaging of the addon should then create the settings.xml file and place it into the correct spot, so when it's installed it'll work, or are you suggesting that something change in Kodi that will support loading settings.xml for game addons from the profile folder?

Also, I'm (fairly?) certain that previous versions of these addons did not have this issue. Are they packaged differently now? I failed to mention it in the original, but I recently updated to OSX 11.6 so maybe that did it as well.

garbear commented 2 years ago

Sorry, I glossed over this fact. The settings generation here isn't used. Settings are generated by the kodi-game-scripting infra, which syncs the settings to all GitHub repos.

zach-morris commented 2 years ago

Ah, ok. Seems thats not working then. I'll close this and open one there.

garbear commented 2 years ago

Which core are you trying to generate settings for? I've had to use this code as a backup when kodi-game-scripting failed for one of the cores, so it should do the job if you need to generate settings for most cores that use v1 of the libretro settings API.

zach-morris commented 2 years ago

I wasn't trying to generate the settings, just trying to configure the addon in Kodi after a fresh install. While sleuthing through the addon directories ascertained how to manually make it work - as I said in the first post I wasn't sure I put this issue in the right repo, seems like this belongs in kodi-game-scripting because the settings and language files aren't being packaged in the addons in all cases.

garbear commented 2 years ago

kodi-game-scripting does our packaging, including settings generation. Can you open an issue there? EDIT: I see it thanks