[LINUX] Getting emuLauncer python script to work under XBMC for Linux
#1
So i've fiddled around with the emuLauncher python script that "blittan" and "bjs1400" made.
First i don't pretend that know anything about python or the Xbox, i just changed a few things to make it more "linuxified"
I've put in "/" instead of "\\" and hardcoded the path to my mame roms..
It runs and lists all my roms but when i select a rom it just closes XBMC without an error.
It's the launch code that i guess needs to be changed:

Code:
xbmc.executebuiltin('XBMC.Runxbe(' + SHORTCUT + ')')

I guess xbms.executebuiltin can't launch a linux executable...

The complete script with all files can be dl from xbmcscripts.com
I have installed advanceMame in /usr/local/bin
In config.xml you specify your emulators and rom path's

config.xml:
Code:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<emulators>
    <emu>AdvanceMAME</emu>
        <emupath>/usr/local/bin/advmame</emupath>
        <rompath>/home/alesve/.advance/rom/</rompath>
        <romext></romext>
        <icon>E:\emulators\zsnexbox\default.tbn</icon>
    <emu>Sega Genesis</emu>
        <emupath>e:\apps\emulators\neogenesis\default.xbe</emupath>
        <rompath>e:\apps\emulators\neogenesis\sgenroms\</rompath>
        <romext>zip</romext>
        <icon>q:\scripts\emuLauncher\images\genesis.png</icon>
    <emu>Nintendo 8-Bit</emu>
        <emupath>E:\emulators\fceultra_v16\default.xbe</emupath>
        <rompath>E:\emulators\fceultra_v16\roms\</rompath>
        <romext>zip</romext>
        <icon>E:\emulators\fceultra_v16\default.png</icon>
</emulators>

Well, what do you think?
Reply
#2
apps are probably launched differently on linux than xbox.
Reply
#3
You can't run xbe files on linux silly thats the whole point of making it for linux or we would just run it
Reply
#4
Jezz_X Wrote:You can't run xbe files on linux silly thats the whole point of making it for linux or we would just run it

well, duh.. Wink that's my conclution too:
Quote:It's the launch code that i guess needs to be changed:

Code:

xbmc.executebuiltin('XBMC.Runxbe(' + SHORTCUT + ')')

I guess xbms.executebuiltin can't launch a linux executable...
Note, i have not written this code, it's from the original emuLauncher python script. I just cut out the part that launches the emulator + gamerom.

The questions are: how do we change the launchcode to launch a linux exe?
Is "xbmc.executebuiltin" even available on this linux port?
And what is "XBMC.Runxbe"?
Reply
#5
" what is "XBMC.Runxbe"? " from my days programming in c, i would say that it means XboxMediaCenter run (launch program) xbe. Where xbe is the xbox executable.

maybe something like this?

Code:

xbmc.executebuiltin('XBMC.Runxbe(' + SHORTCUT + ')') replace shortcut with /home/tony/mame/mamegui ? something like that. Although the runxbe may need to be replaced with something else.

On a side note... can't we just make a link maybe using .cut files to launch other apps in Linux?
Reply
#6
Don't think that .cut file works (or at least i couldn't get it to work last time i tried) however you could always grab the linux mame emulatar and write a python script like this:

Code:
#!/usr/bin/python
import os
cmd = 'xmame'
os.system(cmd)

You could then tie a button on the home screen to launch this python script or just launch it from the scripts window. Hope that helps.
Reply
#7
so to launch a program in xbmc-linux, you would make a python launcher, then link to it by editing the home screen xml

python code: ?

#!/usr/bin/python {this calls the python interpreter correct?}
import os {no idea what this does}
cmd = 'xmame' {is this where the path to the Linux executable goes?}
os.system(cmd) {or does it go here?}

anyone?
Reply
#8
Rand Al Thor Wrote:Don't think that .cut file works (or at least i couldn't get it to work last time i tried) however you could always grab the linux mame emulatar and write a python script like this:

Code:
#!/usr/bin/python
import os
cmd = 'xmame'
os.system(cmd)

You could then tie a button on the home screen to launch this python script or just launch it from the scripts window. Hope that helps.

Heh! Thanks! Cool, i made a file namned 1943.py
With this in it:

Code:
#!/usr/bin/python
import os
cmd = 'advmame 1943'
os.system(cmd)

And it worked!, it launched the mame game "1943" and XBMC continued running in the background!!!

And i guess you could also just use

Code:
#!/usr/bin/python
import os
os.system('advmame 1943')
Yes, i just tried it too..

Now that was easy, but i want to use the other code from the emuLauncher script, it lists all my roms and you can use other emulators too...

This is the magic code:

xbmc.executebuiltin('XBMC.Runxbe(' + SHORTCUT + ')')

SHORTCUT is a string that contains the path to the emulator, ex "/usr/local/bin/advmame" and the rom filename, ex "mario"

As LittleBear1981 wrote, XBMC.Runxbe launches a Xbox exefile and it want it to execute a linux exe instead.. maybe something like:
Code:
xbmc.executebuiltin('os.system(' + SHORTCUT + ')')
hmmm, gonna fiddle around with it a little...
Reply
#9
would this work with sdlmame 0122u5? it looks as though it will emulate just about anything! including N64.
Reply
#10
Not that I know anything about python - but why would it be:

xbmc.executebuiltin('os.system(' + SHORTCUT + ')') ?

executebuiltin probably is there to launch a builtin xbmc command, the parameter in parentheses being the command.

XBMC.Runxbe(' + SHORTCUT + ')

Now that command is Runxbe, obviously there to laun an .xbe file with a parameter. The Parameter is the part in parentheses part.

Now I would say, the only thing relevant you will have to figure out is, what the SHORTCUT variable contains, if it is just the gamename you could probably use it directly with the os.system('advmame SHORTCUT') - although this is the part I have to pass, knowing nothing about python and how it handles strings in variables etc.
Reply
#11
LittleBear1981 Wrote:would this work with sdlmame 0122u5? it looks as though it will emulate just about anything! including N64.

According to the original author it should work on any emulator that supports commandline launching of rom's, like:

$emulatorexe romfile

You just have to edit a .xml file and specify where the emulator and roms are located.

The original emuLauncher package:
From http://www.xbmcscripts.com:
http://www.xbmcscripts.com/index.php?opt...&Itemid=36

My modified default.py:
http://rapidshare.com/files/84460115/default.py.html

My modified config.xml:
http://rapidshare.com/files/84460116/config.xml.html

hotzenpl0tz, you are right, I have changed the launchcode to something more linuxified, this is a part of the original code:

Code:
def LaunchRom(self, title):
        SHORTCUT = HOME_DIR + CUT_FILE
        f=open(SHORTCUT, "wb")
        f.write("<shortcut>\n")
        f.write("    <path>" + self.emupath[self.index] + "</path>\n")
        f.write("    <custom>\n")
        f.write("       <game>" + title + self.romext[self.index] + "</game>\n")
        f.write("    </custom>\n")
        f.write("</shortcut>\n")
    f.write(self.emupath[self.index] +" " + title)            #verify launch strings, writes to file launch.cut
        f.close()
##  xbmc.executebuiltin('XBMC.Runxbe(' + SHORTCUT + ')')            #The original
        os.system(' + self.emupath[self.index] +" " + title + ')              #my modified

I removed SHORTCUT because it contained alot of other stuff.

When i run the script it lists my roms but when i select one XBMC closes without error and mame does not start.

Now, i know that my test code

Code:
#!/usr/bin/python
import os
cmd = 'advmame 1943'
os.system(cmd)

works, mame launches the game 1943 and XBMC continues to run in the backround, so i know os.system is the command to use...

There must be some other things in the default.py script that makes XBMC bomb out when i select a rom.
So, feel free to download the script and see for your self.... plz?Wink
Reply
#12
Does the user that runs xbmc have execute rights on the advmame file ? Other than that, I can't be of more help, someone who knows his way around python will need to step in Smile Something that might be helpfull is if you find a way to debug your command, probably there is some kind of MsgBox command or simmilar in python that you could use to show your variable contents. Then you could name the parameter variable "cmd" - and just let it show a MsgBox with the content of that variable before trying to launch the system command, so you know what it really is sending to your system.
Reply
#13
Major breakthrough!!!
I have managed to get it to launch games!!!
Image
It didn't work with just:
Code:
os.system(' + self.emupath[self.index] +" " + title + ')
I had to make a variable of it first like:
Code:
COMMAND = (self.emupath[self.index] +" " + title)
os.system(COMMAND)
I don't know why, it is the same thing...
Here's my modified "default.py"
http://rapidshare.com/files/85349900/default.py
I have some bugs left:
* when i close mame it also closes XBMC.
* The search function works but it does not launch the rom
But if you would like to try it out:
You need the emuLauncher package from xbms scripts.
Just dl and extract in your /BUILD/scripts
And replace the default.py with mine.
Edit the config.xml with your emulator info (your emulator have to support command-line launching of the rom...)
Go!
Here's my example config.xml: ( I have only entered info on advancemame, Sega and Nintendo are remains from the Xbox version but i have let it remain...)
Code:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<emulators>
    <emu>AdvanceMAME</emu>
        <emupath>/usr/local/bin/advmame</emupath>
        <rompath>/home/alesve/.advance/rom/</rompath>
        <romext></romext>
        <icon>/home/alesve/.advance/mame.jpg</icon>
    <emu>Sega Genesis</emu>
        <emupath>e:\apps\emulators\neogenesis\default.xbe</emupath>
        <rompath>e:\apps\emulators\neogenesis\sgenroms\</rompath>
        <romext>zip</romext>
        <icon>q:\scripts\emuLauncher\images\genesis.png</icon>
    <emu>Nintendo 8-Bit</emu>
        <emupath>E:\emulators\fceultra_v16\default.xbe</emupath>
        <rompath>E:\emulators\fceultra_v16\roms\</rompath>
        <romext>zip</romext>
        <icon>E:\emulators\fceultra_v16\default.png</icon>
</emulators>
Reply
#14
FWIW I'm impressed. I looked into getting some form of MAME working on the box but everything I looked at was either years old or Windows based. This is somehting I'm VERY interested in and appreciate that you're working towards making it happen. Still working on other things here with yet another O/S rebuild. Please keep everyone posted! What are you going to use for a controller?
Reply
#15
Thanks for your words, it's always nice to know your work is being appreciated!Big Grin
Regarding controller, it's up to the specific emulator you decide you want to use...
I don't know what kind of controller advanceMame supports ( i've only used keyboard so far...) but i hope i can use some sort of USB gamepad.

I will keep you all posted on my progress ( or lack of progress..Wink)
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] Getting emuLauncer python script to work under XBMC for Linux0