Kodi Community Forum
Beta Advanced Emulator Launcher - Multi-emulator frontend for Kodi - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Game Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=291)
+---- Thread: Beta Advanced Emulator Launcher - Multi-emulator frontend for Kodi (/showthread.php?tid=287826)



RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - marcoooo - 2018-07-04

mayby 

Wintermute0110 can shine a light on this issue  to see what the diffrents is between the addon  internet archieve  rom launcher   how that is handeling the start commands


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - Wintermute0110 - 2018-07-04

(2018-07-04, 09:14)marcoooo Wrote: mayby 

Wintermute0110 can shine a light on this issue  to see what the diffrents is between the addon  internet archieve  rom launcher   how that is handeling the start commands
I'm overseas in a business trip.

Ok, I will have a look at IARL code to see the Android Oreo launching commands. Keep in mind that I don't have a Kodi Android testing device, you will need to do all the testing yourselves.


Advanced Emulator Launcher - Multi-emulator frontend for Kodi - Wintermute0110 - 2018-07-04

Have a look at this file which seems to have IARL launching commands. Android are at the bottom of the file. I recommend you use an XML in AEL to configure your launcher.

Apparently IARL uses /usr/bin/am so I'm puzzled why it does not work in AEL. Maybe is something related to other arguments need by am in Oreo.

https://github.com/zach-morris/plugin.program.iarl/blob/master/resources/data/external_command_database.xml


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - marcoooo - 2018-07-04

thnx wintermute0110 

i will flash the shield back to the oreo (had flashed a custom rom to keep the games going) 

the diffrance i see  is that in the config off iarl  we have by the emulator name  " external"   and  by yours we have "system/bin/AM" 

  so i am not sure what we have to put  by the emulator name instead off the system/bin/am  will do some testing tonight


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - malte - 2018-07-04

Maybe it is the python code that launches system/bin/am. I compared the code of our three Addons and they are all a bit different.

If I grabbed the correct parts of your addons it looks like this:

IAGL (Non-Android)
Code:
subprocess.call(self.external_launch_command,shell=True)
IAGL (Android):
Code:
subprocess.call(self.external_launch_command,shell=True,executable='/system/bin/sh')
RCB
Code:
subprocess.Popen(cmd, shell=True)
AEL
Code:
subprocess.call(command, stdout = f, stderr = subprocess.STDOUT, close_fds = True)

The difference seems to be the "executable='/system/bin/sh'" part in IAGLs launch code. Maybe thats the trick. But as Wintermute I can't test on Android 8, so I can't tell if this will work.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - chrisism - 2018-07-04

I can go and play around with it. The executable argument with the IAGL call however is something that is normally a part of the Popen method. At least python docs don't show it as an argument (with python 2.7 though).


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - zachmorris - 2018-07-09

I'm not convinced it's working in IAGL either (at least completely).  Android really sucks for all it's little oddball way of doing things.  Some users have noted it's not working with Oreo, and I'm guessing it may be some permissions change in the OS.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - chrisism - 2018-07-09

Yes I believe it something like that. Tried the underlying commands to /system/bin/am through a script/bash app in android and it worked as expected. So perhaps Kodi now has not enough rights to perform these actions. Wanted to see how the buildin 'StartAndroidActivity' method is doing, but this only works with a single intent and data URI, not with all the extra parameters we use for launchers.

When I was digging I got the following execution output:
cmd: Failure calling service activity: Failed transaction (2147483646)

Still trying a couple of different ways of calling the command, but I have a feeling that it is something totally different.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - malte - 2018-07-09

A user in the german forum reported that it is possible to launch Retroarch from IAGL when Retroarch is already running in the background, but it is not possible to create a new instance of Retroarch. Not sure if this information is useful, I just thought I leave it here.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - Wintermute0110 - 2018-07-09

Guys,

Thanks a lot for your help with this issue. I don't have myself an Android device to test so I completely rely on you for testing. Apparently the issue has caught everybody by surprise and it's not easy to find information about how to solve it (if can be solved at all...).

I have found this on Github, which may have some info about the issue. More info from Stack Overflow Can't execute “system” command on Android 8 Oreo. More info from Bounty Source Termux API doesn't work on Android O.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - zachmorris - 2018-07-09

(2018-07-09, 13:52)Wintermute0110 Wrote: Guys,

Thanks a lot for your help with this issue. I don't have myself an Android device to test so I completely rely on you for testing. Apparently the issue has caught everybody by surprise and it's not easy to find information about how to solve it (if can be solved at all...).

I have found this on Github, which may have some info about the issue. More info from Stack Overflow Can't execute “system” command on Android 8 Oreo. More info from Bounty Source Termux API doesn't work on Android O.
 Yes, our google-fu seems to be about the same.  From the termux-am github repository:
Quote:(Activity Manager) command in Android can be used to start Activity or send Broadcast from shell, however since Android Oreo that command only works from adb shell, not from apps. This is modified version of that command that is usable from an app
I haven't been able to find any official Android documentation of that fact though.  I also don't have an Oreo capable device, but I'd be interested to know if the Kodi builtin StartAndroidActivity still works in Oreo - I'm guessing it also wouldn't work.  If it actually does for some odd reason, one option would be to start retroarch with StartAndroidActivity, and then launch a game with similar commands as before (as some users said that works).

Another possible workaround would be to actually install termux-am and change the launch commands to use that.  It appears to be backward compatible with older versions of Android, so I'll install it and see if that may work.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - chrisism - 2018-07-09

(2018-07-09, 19:06)zachmorris Wrote:
(2018-07-09, 13:52)Wintermute0110 Wrote: Guys,
...
 Yes, our google-fu seems to be about the same.  From the termux-am github repository:
Quote:...
I haven't been able to find any official Android documentation of that fact though.  I also don't have an Oreo capable device, but I'd be interested to know if the Kodi builtin StartAndroidActivity still works in Oreo - I'm guessing it also wouldn't work.  If it actually does for some odd reason, one option would be to start retroarch with StartAndroidActivity, and then launch a game with similar commands as before (as some users said that works).

Another possible workaround would be to actually install termux-am and change the launch commands to use that.  It appears to be backward compatible with older versions of Android, so I'll install it and see if that may work. 
I was thinking about that too. Want to see what StartAndroidActivity does and been checking out the source code of kodi. But it is rather specific to using dataURIs as input, which isnt enough anyways.
As I said I tried the commands executed by AEL/Kodi directly in a terminal app on the Shield and it actually worked. So it might even be something that Kodi just needs more privilleges to actually execute it like this with the last Android update.
Keep us posted, I'll do the same.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - malte - 2018-07-12

In latest RCB release I fixed a general Android bug and now users reported that they were able to launch games on Android 8 with RCB. I looked through my launching code again and found that I am using two different methods to launch games (it is up to the user to decide which command is used):
Code:
process = subprocess.Popen(cmd.encode('utf-8'), shell=True)
 
Code:
os.system(cmd.encode('utf-8'))

I guess it is the second piece of code as this is the default option. Maybe this will also work for you.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - Wintermute0110 - 2018-07-13

(2018-07-12, 19:18)malte Wrote: In latest RCB release I fixed a general Android bug and now users reported that they were able to launch games on Android 8 with RCB. I looked through my launching code again and found that I am using two different methods to launch games (it is up to the user to decide which command is used):
Code:
process = subprocess.Popen(cmd.encode('utf-8'), shell=True)
Code:
os.system(cmd.encode('utf-8'))

I guess it is the second piece of code as this is the default option. Maybe this will also work for you.  
Thanks a lot Malte.

@chrisism Can you please confirm if this works?

Also, I will request to core devs a new API function for Kodi to report the running platform (linux, android, win32, win64, etc.). Currently Python does not differentiate between the different flavors of UNIX but AEL will use different launching mechanisms for Linux and Android.

EDIT: I have found an easy way to detect android among the UNIXes here.


RE: Advanced Emulator Launcher - Multi-emulator frontend for Kodi - chrisism - 2018-07-13

@malte thanks for the info. @Wintermute0110 Unfortunately no results. Tried it a second time with Retroarch already started and also no luck.
Also "os.system" is the old way of executing processes. It has been replaced by subprocess.call()..

But it might also have to do with the way the application is called. Currently I am using:
python:

/system/bin/am start --user 0 -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -e ROM .....

Do we need to do it in a different way now?

P.S. @Wintermute0110 Check the master branch Wink Already added a nice is_android() method in the utils class. Definitly should be splitting the execution of Linux and Android, don't want to bother perfect working stuff on Linux with the hassle of Android.