zach-morris / plugin.program.iagl

The Internet Archive Game Launcher (IAGL) will launch Games from the Internet using Kodi
GNU General Public License v3.0
344 stars 49 forks source link

Automatic setup for LibreElec and CoreElec distros #285

Open MegaBidoof opened 1 year ago

MegaBidoof commented 1 year ago

Hello, apologies for being a noob. I am currently running CoreELEC on a generic s905x4 4GB/32GB box. I'm running RetroArch as an addon through this: https://discourse.coreelec.org/t/retroarch-kodi-add-on-for-coreelec/17482.

When launching a game through IAGL with RetroArch set as the external player, the game launches, but Kodi keeps running in the background. The problem with this is that whenever an element in the Kodi UI gets updated, that element pops into the foreground (where RetroArch is), glitching the screen. Similarly, whenever an element in RetroArch updates, it pops back into the foreground. Hopefully this video is informative.

I have tried turning "Close Kodi on Launch" and "Pause Kodi on Launch" on and off, to no avail (in fact, when "Close Kodi on Launch" is turned on, the game runs at 2x speed with no sound, along with the aforementioned problem).

Pressing buttons on the IR remote controls Kodi (even when RetroArch is running, if it was launched by IAGL), forcing the UI to update and exacerbating the bug (I demonstrate that later in the video). Similarly, the connected game controller (Nintendo Switch Pro Controller) controls RetroArch, forcing some elements to visually update and bringing them back to foreground.

However, if RetroArch is launched directly from Kodi (and not from IAGL), this does not happen, and everything works fine, with no bug, and the IR remote controller starts controlling RetroArch.

Hopefully, this is the correct log (as I mentioned, I'm a noob): 01_KODI.log

Also, is this the correct settings file (changed from xml to be able to upload)? Is there a better way to show you my current settings? settings.txt

Thank you for your help and for this amazing addon. Apologies if there is documentation or a previous issue about the same thing, I looked but couldn't find any.

zach-morris commented 1 year ago

Thanks for the log. I see the launch command is just straight launching retroarch with this command:

 ".../script.retroarch.launcher.Amlogic-ng.arm/bin/retroarch" -L "/.../mgba_libretro.so" "...game.gba"

For most linux environments you need to use a 'helper script' to close kodi, launch retroarch and the game, then reopen kodi after retroarch is closed, which is why you get the wonky result.

I've never heard of this addon, but googling looks like a cool option for coreelec. Looking at the addon, I think there's the helper script included. Here's what i think is needed (based on this post): 1) In IAGL set you system environment as Linux, path to retroarch as:

systemd-run "/storage/.kodi/addons/script.retroarch.launcher.Amlogic-ng.arm/bin/retroarch.start"

2). Update config path to ??? (I assume you already set this, but it needs to match whatever Retroarch says is where it's saving it's config). I think its:

/storage/.kodi/addons/script.retroarch.launcher.Amlogic-ng.arm/config/retroarch.cfg

3) Both exit and pause Kodi should be disabled (the helper script should do this part)

4) Update the launcher for a game list, or run the wizard again to update all the commands for the game lists with the new settings.

Now you should be able to launch games (hopefully?). You can review the launch command by selecting a game list and select the context menu 'View list settings'. The launch command should read something like:

systemd-run "/storage/.kodi/addons/script.retroarch.launcher.Amlogic-ng.arm/bin/retroarch.start" -L "path_to/corename_libretro.so" "%ROM_PATH%"
MegaBidoof commented 1 year ago

I had actually already tried setting the path to RetroArch as /retroarch.start, but, because I'm a noob, I didn't run the wizard, as I didn't know it was necessary. So, of course, no change happened.

Currently, the config file in RetroArch is set in storage/.config/retroarch/retroarch.cfg, but it is the same path that is registered in IAGL, so I assume it should be ok.

I have now set it as /retroarch.start again, but ran the wizard this time. After manually adding systemd-run to the list launch command, it works! So thank you very much.

Is it possible to add systemd-run automatically to all lists, or do I have to do it manually for each one? Because there's a lot of lists. Maybe if I run the wizard again and choose the option to select the cores manually for each list (instead of selecting automatically) it will prompt me to update the launch command whenever I try a new list?

zach-morris commented 1 year ago

Yes, i'll keep this open to make this more automatic for LibreElec and CoreElec distros. Its on my list to do.

For now, you should be able to manually edit the setting in the xml, so it's applied to all lists:

<setting id="iagl_external_path_to_retroarch">systemd-run "/storage/.kodi/addons/script.retroarch.launcher.Amlogic-ng.arm/bin/retroarch.start"</setting>

Also worth maybe trying to alert a user when a setting for launching has changed, but the setting hasn't been applied to the game list(s)