[SOLVED] Launching RetroArch from System.Exec


#1

Hi,

First of all, thank you for the great work to make this wonderfull software.

I didn’t found another subforum to ask for this. Sorry if it is not the accurate place. I know that it is not a CE problem itself but I can`t find how to solve it.

I installed RetroArch and make a simple script to launch it:

systemctl stop kodi

/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &

systemctl start kodi

If I run it from CLI works well but if I try to run from any Kodi skin using System.Exec command doesn’t work

It stops Kodi and doesn’t run the RetroArch command.

I’m afraid that when kodi stops the script stops also.

Anybody knows how can I solve this?

Thanks in advance.


#2

You need to use systemd-run to launch some script:
systemd-run /path/some_script.sh

Then you can stop kodi inside that script.
The problem is that when kodi is stopped also script is stopped. And retroarch is not excuted.


#3

Thank you.

I’ll try it.


#4

Sorry, but with systemd-run the retroarch app doesn’t start

First, systemctl stop kodi runs well and then systemctl start kodi, but the retroarch line doesn’t work.

Any other idea to play with?

Thanks again.


#5

@shanti had some scripts for doing exactly this, maybe he can help.


#6

@Txemoto as you already found out, any script that is attempted to start after killing kodi will not run, so there are 2 things you could try.

First is as @vpeter said… create a script file that will run and check if retroarch is still running

something like this

/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &
systemctl stop kodi
while pgrep retroarch > /dev/null; do sleep 1; done
systemctl start kodi

(notice how kodi is stopped after running retroarch )

then call it like this:

systemd-run /path/some_script.sh

another more complex option if you want to go that route is check an add-on called Bolt Ons! its very outdated but you can check how they manage to launch retroarch in there

please note that I have not tried this methods as I have a service incorporated in my build that does this.


#7

If you executed retroarch with & at the end it is run in background. I assume it takes some time and kodi started too early.
That’s why try without &.

Or use script like

systemctl stop kodi
/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &
while pgrep retroarch > /dev/null; do sleep 1; done
systemctl start kodi

#8

@vpeter in my very short experience with trying to run stuff from Kodi, this will not work, as Kodi is stopped first so the script will die before it gets a chance to run Retroarch. Unless I am missing something very obvious.

@Txemoto another option you could try is this one :slight_smile:


#9

@shanti: That’s why systemd-run must be used.


#10

Ahh I see, it was a while since I last tried, I can’t remember if I used systemd-run so that might be it! TIL! :smiley:


#11

First of all, many thanks to all of you.

Finally, the trick to make it work were some changes:

  1. As @vpeter said, systemd-run is the most important change
  2. As @shanti recommended, I launched the retroach with “&” before stop kodi, and wait until ends in that loop. Just as said here:

/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &
systemctl stop kodi
while pgrep retroarch > /dev/null; do sleep 1; done
systemctl start kodi

Works perfect!!!

Thanks again.

By the way, @shanti I saw the link to instal retroarch as Kodi addon, but I don’t know if it’s posible to clone a git repository with CoreELEC. It is posible?


#12

It has to be done on a computer running linux, if you don’t have one maybe I can try making it for you :slight_smile:


#13

I made the add-on but its based on my build (sx05re) which is also more up to date than Lakka, it also includes Emulationstation and can be installed on top of CoreELEC


#14

@shanti, would it be possible for you to build it for S912 too?

And I know that this isn’t a CoreElec question but do you know if it is difficult to integrate the add-on with IAGL?


#15

I updated the release to include a S912 version, haven’t tested it properly but it does run.

About the IAGL, I am not familiar with it, so I can’t say if its difficult or not, sorry.


#16

That was fast, thanks!

I’ll continue to investigate how to get IAGL to work.


#17

If it let’s you select the emulator binaries to run and the folders to save roms it should work.

But I don’t see the point, it seems it has its own binaries?


#18

If I have understand it correctly its purpose is to download/store roms and then start retroarch by passing additional arguments while starting it.



#19

Many thanks @shanti

I’ll try it